gpt4 book ai didi

elasticsearch - 如何通过索引名称(通配符)搜索Elasticsearch索引列表

转载 作者:行者123 更新时间:2023-12-02 23:59:34 25 4
gpt4 key购买 nike

在我的Elasticsearch实例中,有大量索引,有些带有日期后缀,有些则没有。

我知道GET _cat/indices可以给我所有索引,但这太多了。

有什么办法可以获取索引名称中以call-开头的所有索引列表?

例如。我想要的结果是:(搜索索引本身,而不是索引文档)

call-staging-201804
call-staging-201805
call-dev-201804
call-dev-201805

谢谢。

最佳答案

是的,您可以使用multiple indicies查询

Most APIs that refer to an index parameter support execution across multiple indices, using simple test1,test2,test3 notation (or _all for all indices). It also support wildcards, for example: test* or test or tet or test, and the ability to "exclude" (-), for example: test*,-test3.


curl -XGET 'http://localhost:9200/index1,index2/_search?q=search'
curl -XGET 'http://localhost:9200/call-*/_search?q=search'
curl -XGET 'http://localhost:9200/_all/_search?q=search'

但要小心,因为这将花费更多时间

关于elasticsearch - 如何通过索引名称(通配符)搜索Elasticsearch索引列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50322786/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com