【问题标题】:How can i get only index name from response generated from elasticsearch如何从弹性搜索生成的响应中仅获取索引名称
【发布时间】:2018-08-28 07:22:32
【问题描述】:

我如何才能从使用 java 调用 _cat/indices 生成的响应中仅获取索引名称。使用EntityUtils,我得到了作为字符串的响应,它为我提供了使用 CURL 命令调用时的外观信息。我正在使用 rest 低级客户端来获取响应。

String responseBody = EntityUtils.toString(response.getEntity());

我应该如何处理 responseBody 以仅获取索引名称?

【问题讨论】:

标签: java elasticsearch curl


【解决方案1】:

ClusterStateResponse 响应 = client.admin().cluster().prepareState().execute().actionGet();

String[] 索引 = response.getState().getMetaData().getConcreteAllIndices();

您将获得索引列表。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-15
    • 1970-01-01
    • 2017-01-26
    • 2016-02-02
    • 1970-01-01
    相关资源
    最近更新 更多