wu-sheng commented on a change in pull request #5132:
URL: https://github.com/apache/skywalking/pull/5132#discussion_r468611606
##########
File path:
oap-server/server-library/library-client/src/main/java/org/apache/skywalking/oap/server/library/client/elasticsearch/ElasticSearchClient.java
##########
@@ -331,9 +333,25 @@ public boolean deleteTemplate(String indexName) throws
IOException {
return response.getStatusLine().getStatusCode() == HttpStatus.SC_OK;
}
+ public SearchResponse search(IndexNameMaker indexNameMaker,
SearchSourceBuilder searchSourceBuilder) throws IOException {
+ String[] indexNames =
Arrays.stream(indexNameMaker.make()).map(this::formatIndexName).toArray(String[]::new);
+ return search(indexNames, searchSourceBuilder);
+ }
+
public SearchResponse search(String indexName, SearchSourceBuilder
searchSourceBuilder) throws IOException {
indexName = formatIndexName(indexName);
- SearchRequest searchRequest = new SearchRequest(indexName);
+ return doSearch(searchSourceBuilder, indexName);
+ }
+
+ public SearchResponse search(String[] indexNames, SearchSourceBuilder
searchSourceBuilder) throws IOException {
+ indexNames =
Arrays.stream(indexNames).map(this::formatIndexName).toArray(String[]::new);
+ return doSearch(searchSourceBuilder, indexNames);
+ }
+
+ private SearchResponse doSearch(SearchSourceBuilder searchSourceBuilder,
+ String... indexNames) throws IOException {
+ SearchRequest searchRequest = new SearchRequest(indexNames);
+ searchRequest.indicesOptions(IndicesOptions.fromOptions(true, true,
true, false));
Review comment:
Are other values default?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]