You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2022/07/13 06:37:49 UTC

[GitHub] [skywalking] wu-sheng commented on a diff in pull request #9339: Optimize elasticsearch query performance by using `_mGet` and physical index name

wu-sheng commented on code in PR #9339:
URL: https://github.com/apache/skywalking/pull/9339#discussion_r919700305


##########
oap-server/server-library/library-client/src/main/java/org/apache/skywalking/oap/server/library/client/elasticsearch/ElasticSearchClient.java:
##########
@@ -300,13 +303,33 @@ public boolean existDoc(String indexName, String id) {
         return es.get().documents().exists(indexName, TYPE, id);
     }
 
-    public SearchResponse ids(String indexName, Iterable<String> ids) {
-        indexName = indexNameConverter.apply(indexName);
+
+    /**
+     * @since 9.2.0 Provide to get documents from multi indices by ids.
+     * @param indexIdsGroup key: indexName, value: ids list
+     * @return Documents
+     */
+    public Optional<Documents> ids(Map<String, List<String>> indexIdsGroup) {
+        Map<String, List<String>> map = new HashMap<>();
+        indexIdsGroup.forEach((indexName, ids) -> {
+            map.put(indexNameConverter.apply(indexName), ids);
+        });
+        return es.get().documents().mGet(TYPE, map);
+    }
+
+    /**
+     * Query by ids with index alias. When can not locate the physical index.
+     * @param indexAlias Index alias name
+     * @param ids Query ids
+     * @return SearchResponse
+     */
+    public SearchResponse idsWithIndexAlias(String indexAlias, Iterable<String> ids) {

Review Comment:
   Where would we use `idsWithIndexAlias`?



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org