【问题标题】:Get list of index names matching pattern from elastic search - JAVA从弹性搜索中获取匹配模式的索引名称列表 - JAVA
【发布时间】:2016-09-09 16:12:27
【问题描述】:

我在弹性搜索中有一个索引列表如下:

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

现在我只想要那些与我的模式“test-*”匹配的索引。

我可以通过以下语义查询来达到上述结果:

GET test-*/_aliases

我想从 java 代码中获得相同的结果。

【问题讨论】:

    标签: java list elasticsearch


    【解决方案1】:

    响应/test-*/_aliases 的 REST 端点执行以下操作 (see here):

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

    【讨论】:

    • 我可以用逗号分隔的模式来获取索引吗?例如:GET test-*,index-*/_aliases ???
    • 我正在使用不支持执行的 1.7.4 弹性搜索客户端库。
    • 抛出 java.lang.ArrayIndexOutOfBound 异常
    • 你能用完整的堆栈跟踪更新你的问题吗?
    • 9200 是 HTTP 端口(对于任何 HTTP 客户端),9300 是 TCP 端口(对于传输客户端)。所以你的 ES 实际上打开了两个端口,这很正常
    猜你喜欢
    • 2015-03-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多