ElasticSearch 5.6.3
にネストされたドキュメントの集計に問題があります。ElasticSearch 5.6.3でネストされたドキュメントの集計を取得すると、Lucene例外が発生する
私のクエリは次のように構成されています。私は(そしてもちろん削除ネストされたAGGで)非ネストされたフィールドに集計をしてみてください
query
aggs
|_filter
|_nested
|_term
|_top-hits
場合、期待どおり、すべてが動作します。それが今で構成されているようしかし、私はLuceneのから例外を受け取る: Child query must not match same docs with parent filter. Combine them as must clauses (+) to find a problem doc. docId=2147483647, class org.apache.lucene.search.ConstantScoreScorer
この例外はElasticSearch 2.4.6
でトリガないです。
私は集計を別の方法で構造化しようとしましたが、うまくいく組み合わせを見つけ出すことができませんでした。
"recording": {
"dynamic": "strict",
"_all" : {
"enabled" : false
},
"properties": {
"id": {
"type": "integer"
},
"soloists": {
"properties": {
"type": "nested",
"person": {
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string",
"index": "not_analyzed"
}
}
}
},
"work": {
"id": {
"type": integer
},
"title": {
"type": "string",
"index": "not_analyzed"
}
}
}
とクエリ自体::
これは、マッピングがどのように見えるかです
{
"query": {},
"aggs": {
"my_top_results": {
"global": {},
"aggs": {
"my_filter_agg": {
"filter": {
"bool": {
"must": [
{
"bool": {
"should": [
{
"nested": {
"path": "soloists",
"query": {
"bool": {
"must": {
"match": {
"soloists.person.id": 77957
}
}
}
}
}
}
]
}
}
]
}
},
"aggs": {
"my_nested_agg": {
"nested": {
"path": "soloists"
},
"aggs": {
"my_terms_agg": {
"term": {
"field": "soloists.person.id",
"size": 10
}
"aggs": {
"my_top_hits_agg": {
"size": 1,
"_source": {
"include": [
"soloists.person.id",
"soloists.person.name"
]
}
}
}
}
}
}
}
}
}
}
}
}
すべてのヘルプは高く評価されるだろう。
解決策を探している間、私は偶然見つけいくつかのリンク:
- https://issues.apache.org/jira/browse/LUCENE-7674
- https://discuss.elastic.co/t/querying-on-a-subobject-field-within-a-nested-object/65533
- https://github.com/elastic/elasticsearch/issues/23280
- https://github.com/elastic/elasticsearch/issues/11749
Hey Claudiuはまず、 'my_top_hits_agg'が適切な場所にないこと、' my_terms_agg'集約の中に位置し、 'top_hits'キーワードが欠けていること、そうですか?私はクエリがまったく実行されるのに驚いています。 – Val
ちょっと@Val!そのような偶然のような会合。あなたはまったく正しい - それは私の側にコピーペーストエラーだった。ちょうどクエリを修正しましたが、問題は残っています... – cvursache
確かに;-)最小限必要なもの、つまりネストされたフィルタ(bool/must + bool/should部分を削除する)にフィルタを単純化するとどうなりますか? – Val