-
Notifications
You must be signed in to change notification settings - Fork 180
Extend query size limit using scroll #716
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
Changes from all commits
e2aac98
289ff47
f612a9e
2201cc2
a62b25d
e8abd9a
6691803
668b92b
fd477b0
80d213c
135c012
4ec69f1
919ccb6
7b6b07f
b1bee34
5b40987
4a585a9
edb2eb3
aa4034d
e2361ff
f2ddb87
d7d233c
1bc9037
8c07640
1a7983f
17cf25c
fd47234
669d787
589a77b
aa703b4
8aed5cc
1ace2de
6ec8da0
208921e
ff02665
52ba001
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,12 +11,15 @@ | |
| import java.io.IOException; | ||
| import java.util.Arrays; | ||
| import java.util.Collection; | ||
| import java.util.HashMap; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.stream.Collectors; | ||
| import java.util.stream.Stream; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.opensearch.action.admin.cluster.settings.ClusterGetSettingsRequest; | ||
| import org.opensearch.action.admin.indices.settings.get.GetSettingsRequest; | ||
| import org.opensearch.action.admin.indices.settings.get.GetSettingsResponse; | ||
| import org.opensearch.action.search.ClearScrollRequest; | ||
| import org.opensearch.client.RequestOptions; | ||
| import org.opensearch.client.RestHighLevelClient; | ||
|
|
@@ -26,6 +29,7 @@ | |
| import org.opensearch.client.indices.GetMappingsResponse; | ||
| import org.opensearch.client.node.NodeClient; | ||
| import org.opensearch.cluster.metadata.AliasMetadata; | ||
| import org.opensearch.common.collect.ImmutableOpenMap; | ||
| import org.opensearch.common.settings.Settings; | ||
| import org.opensearch.sql.opensearch.mapping.IndexMapping; | ||
| import org.opensearch.sql.opensearch.request.OpenSearchRequest; | ||
|
|
@@ -54,6 +58,36 @@ public Map<String, IndexMapping> getIndexMappings(String... indexExpression) { | |
| } | ||
| } | ||
|
|
||
| @Override | ||
| public Map<String, Integer> getIndexMaxResultWindows(String... indexExpression) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need mapping or just single maxResultWindow?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I approach this in a way similar to how |
||
| GetSettingsRequest request = new GetSettingsRequest() | ||
| .indices(indexExpression).includeDefaults(true); | ||
| try { | ||
| GetSettingsResponse response = client.indices().getSettings(request, RequestOptions.DEFAULT); | ||
| ImmutableOpenMap<String, Settings> settings = response.getIndexToSettings(); | ||
| ImmutableOpenMap<String, Settings> defaultSettings = response.getIndexToDefaultSettings(); | ||
| Map<String, Integer> result = new HashMap<>(); | ||
|
|
||
| defaultSettings.forEach(entry -> { | ||
| Integer maxResultWindow = entry.value.getAsInt("index.max_result_window", null); | ||
| if (maxResultWindow != null) { | ||
| result.put(entry.key, maxResultWindow); | ||
| } | ||
| }); | ||
|
|
||
| settings.forEach(entry -> { | ||
| Integer maxResultWindow = entry.value.getAsInt("index.max_result_window", null); | ||
| if (maxResultWindow != null) { | ||
| result.put(entry.key, maxResultWindow); | ||
| } | ||
| }); | ||
|
|
||
| return result; | ||
| } catch (IOException e) { | ||
| throw new IllegalStateException("Failed to get max result window for " + indexExpression, e); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public OpenSearchResponse search(OpenSearchRequest request) { | ||
| return request.search( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.