简体   繁体   English

获取与弹性搜索模式匹配的索引名称列表 - JAVA

[英]Get list of index names matching pattern from elastic search - JAVA

I have a list of indexes in elastic search as follow: 我在弹性搜索中有一个索引列表如下:

index1, index2, index3, test-index1, test-index2, test-index3

Now I want only those indexes that matches my pattern "test-*". 现在我只想要那些匹配我的模式“test- *”的索引。

I can achieve the above result by following sense query: 我可以通过跟随感知查询来实现上述结果:

GET test-*/_aliases

I want to achieve the same result from java code. 我想从java代码中获得相同的结果。

The REST endpoint that responds to /test-*/_aliases does the following ( see here ): 响应/test-*/_aliases的REST端点执行以下操作( 请参见此处 ):

    GetAliasesResponse getAliasesResponse = client().admin().indices()
        .prepareGetAliases()
        .setIndices("test-*", "index-*").get();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM