Indices 查询

原文链接 : https://www.elastic.co/guide/en/elasticsearch/reference/5.0/query-dsl-indices-query.html

译文链接 : http://www.apache.wiki/pages/viewpage.action?pageId=4882908

贡献者 : 蓝色飞扬

<< Boosting Query Joining Queries >>


Indices Query

Indices 查询 - 图1在5.0.0中已弃用。

用搜索 _index 字段来代替

Indices 查询是在搜索跨多个指标执行的情况下非常有用。 它允许指定索引名称的列表和内部查询,该内部查询仅对与该列表上的名称匹配的索引执行。 对于被搜索、但没有在名单上的条目相匹配其他指数,使用 no_match_query 代为执行。

  1. GET /_search
  2. {
  3. "query": {
  4. "indices" : {
  5. "indices" : ["index1", "index2"],
  6. "query" : { "term" : { "tag" : "wow" } },
  7. "no_match_query" : { "term" : { "tag" : "kow" } }
  8. }
  9. }
  10. }

可以使用 index 字段,以提供一个单一的索引。 no_match_query 的取值是“string”,可以为 none (匹配任何文件),也可以为 all (匹配所有)。 默认为allquery 是强制性的,此外还有 indices (或 index )也是强制性。


<< Boosting Query Joining Queries >>