Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowing non-rollup and rollup indices to be searched together #1268

Merged

Conversation

tandonks
Copy link
Contributor

@tandonks tandonks commented Sep 27, 2024

Description

Introduced a new setting ROLLUP_SEARCH_SOURCE_INDICES which when set to true allows users to search non-rollup and rollup indices together.
It's just a way to perform searches together of non-rollup and rollup indices. In order to use it, users need to update the cluster settings and set the above setting to true.

Related Issues

Resolves #1213

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@sarthakaggarwal97
Copy link
Contributor

thanks @tandonks for taking this change up! LGTM
@vikasvb90 @bowenlan-amzn would you please take a look, thank you

@bowenlan-amzn
Copy link
Member

Thanks.

What would be the condition to use this? Better to provide the instructions for normal users on when they can enable this and search source and target.

@@ -1092,12 +1092,12 @@ class RollupInterceptorIT : RollupRestTestCase() {
},
"aggs": {
"sum_passenger_count": { "sum": { "field": "passenger_count" } },
"max_passenger_count": { "max": { "field": "passenger_count" } },
"value_count_passenger_count": { "value_count": { "field": "passenger_count" } }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why removing value_count?
It's better to check all this values are right in rollup search

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was initially also not being used in the test earlier since we were testing the validation (where we used to throw the exception) on rollup and source index searches together
I was actually trying with that too but was getting an Internal Server Error for the same
{"error":{"root_cause":[],"type":"search_phase_execution_exception","reason":"","phase":"fetch","grouped":true,"failed_shards":[],"caused_by":{"type":"class_cast_exception","reason":"class org.opensearch.search.aggregations.metrics.InternalScriptedMetric cannot be cast to class org.opensearch.search.aggregations.metrics.InternalValueCount (org.opensearch.search.aggregations.metrics.InternalScriptedMetric and org.opensearch.search.aggregations.metrics.InternalValueCount are in unnamed module of loader 'app')"}},"status":500}

@@ -347,6 +353,9 @@ class RollupInterceptor(
if (searchAllJobs) {
request.source(request.source().rewriteSearchSourceBuilder(matchingRollupJobs.keys, fieldNameMappingTypeMap, concreteSourceIndex))
} else {
if (matchingRollupJobs.keys.size > 1) {
logger.warn("Trying search with search across multiple rollup jobs disabled so will give result with largest rollup window")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let move this to trace since multiple such search queries can lead to significant logging.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Signed-off-by: Kshitij Tandon <tandonks@amazon.com>
Signed-off-by: Kshitij Tandon <tandonks@amazon.com>
Signed-off-by: Kshitij Tandon <tandonks@amazon.com>
@tandonks tandonks force-pushed the source_rollup_indices_search branch from 89a044e to c7f003e Compare October 29, 2024 06:14
@vikasvb90 vikasvb90 merged commit dd710e6 into opensearch-project:main Oct 29, 2024
14 of 17 checks passed
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/index-management/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/index-management/backport-2.x
# Create a new branch
git switch --create backport/backport-1268-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 dd710e6367cfea34fe1f6a179bf2e1eb742ee8cb
# Push it to GitHub
git push --set-upstream origin backport/backport-1268-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/index-management/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-1268-to-2.x.

tandonks added a commit to tandonks/index-management that referenced this pull request Oct 29, 2024
…earch-project#1268)

* Allowing non-rollup and rollup indices to be searched together

Signed-off-by: Kshitij Tandon <tandonks@amazon.com>

* Fixing an issue in the integration test

Signed-off-by: Kshitij Tandon <tandonks@amazon.com>

* Using trace in place of warn in logger

Signed-off-by: Kshitij Tandon <tandonks@amazon.com>

---------

Signed-off-by: Kshitij Tandon <tandonks@amazon.com>
tandonks added a commit to tandonks/index-management that referenced this pull request Oct 29, 2024
…earch-project#1268)

* Allowing non-rollup and rollup indices to be searched together

Signed-off-by: Kshitij Tandon <tandonks@amazon.com>

* Fixing an issue in the integration test

Signed-off-by: Kshitij Tandon <tandonks@amazon.com>

* Using trace in place of warn in logger

Signed-off-by: Kshitij Tandon <tandonks@amazon.com>

---------

Signed-off-by: Kshitij Tandon <tandonks@amazon.com>
tandonks added a commit to tandonks/index-management that referenced this pull request Nov 4, 2024
…earch-project#1268)

* Allowing non-rollup and rollup indices to be searched together

Signed-off-by: Kshitij Tandon <tandonks@amazon.com>

* Fixing an issue in the integration test

Signed-off-by: Kshitij Tandon <tandonks@amazon.com>

* Using trace in place of warn in logger

Signed-off-by: Kshitij Tandon <tandonks@amazon.com>

---------

Signed-off-by: Kshitij Tandon <tandonks@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Support searches across raw data indices and rollup indices together
4 participants