0

我正在尝试计算多级嵌套文档中的方面。并且在文档或谷歌中找不到任何示例,但发现了这个:

嵌套元素提供了将使用的嵌套文档(可以是多级嵌套文档)的路径。(http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets.html#_all_nested_matching_root_documents

但是下面的查询不起作用。查询这个方面的正确方法是什么?

http://pastie.org/8526599 - 这是我正在尝试使用的映射

http://pastie.org/8526601 - 这是非工作查询

4

1 回答 1

5

解决了。正确的语法:

{
  "facets": {
    "tf": {
      "terms": {
        "field": "fares.directions.orig.city"
      },
      "nested": "fares.directions"
    }
  }
}

SO - 在嵌套的内部构面定义中,我们需要选择最深的嵌套路径,并且字段必须由完整路径引用

于 2013-12-03T23:10:25.683 回答