ElasticSearch不会在嵌套查询中返回匹配

时间:2018-10-11 09:16:13

标签: amazon-web-services elasticsearch

我正在尝试对嵌套的“文本”进行“匹配”搜索。 我刚刚开始使用AWS ElasticSearch,所以我真的很陌生。

我尽力遵循文档,但是使用点语法“ taxonomy.title” :( https://www.elastic.co/guide/en/elasticsearch//reference/6.2/query-dsl-nested-query.html

这是我查询的一部分:

"match": {"taxonomy.title": {"query": keyword}}

和以下是我的索引的屏幕截图:

enter image description here

1 个答案:

答案 0 :(得分:2)

您忘记了查询中的“嵌套”部分。尝试:

{
  "query": {
    "nested": {
      "path": "taxonomy",
      "query": {
        "match": {
          "taxonomy.title": keyword
        }
      }
    }
  }
}