elasticsearch 在elasticsearch中使用mserch查询排除索引名
我正在使用elasticsearch通过msearch API获取多个索引的日志。 但我需要排除一些索引。假设我有a,b,c,d,e索引,但我不想包括索引b,c 我编写了elasticsearch查询来获取记录:
elasticsearch 在elasticsearch中使用mserch查询排除索引名,
elasticsearch,kibana,
elasticsearch,Kibana,我正在使用elasticsearch通过msearch API获取多个索引的日志。 但我需要排除一些索引。假设我有a,b,c,d,e索引,但我不想包括索引b,c 我编写了elasticsearch查询来获取记录: GET _msearch? {"index":"*","size":100000,"exclude":["b","c"]} //used kibana to check indexes {"query":{}} //required to successfully run the
GET _msearch?
{"index":"*","size":100000,"exclude":["b","c"]} //used kibana to check indexes
{"query":{}} //required to successfully run the query
但我得到的记录包括索引b,c。我检查了文档,但没有得到任何适当的资源。
如何解决此问题???此代码应实现以下功能:
GET _msearch?
{"index":"*,-b,-c","size":100000}
{"query":{}}
注意“index”
值中的负号(-
)
尽管文档页面中没有明确提及,但它看起来像大多数支持多索引执行的API:
大多数引用索引参数的API都支持跨
多个索引,使用简单的test1、test2、test3符号(或_all表示
所有指数)。
它还支持通配符,例如:test*或test或tet或
测试,以及“排除”()的能力,例如:test*,-test3
一般来说,在多个索引上进行搜索是有困难的