Open xlfulove opened 5 years ago
child_fields.sentenceId字段的类型是没有设置分词的
似乎是DSL缺少了应有的过滤条件
@shi-yuan
where条件没生效吧,先看看explain
我本地最新版本的,是可以的
select nested("child_fields.sentenceId") from chatlog
where nested("child_fields",child_fields.sentenceId="2")
group by terms(field="child_fields.sentenceId",nested="child_fields")
{
"from": 0,
"size": 0,
"query": {
"bool": {
"filter": [
{
"bool": {
"must": [
{
"nested": {
"query": {
"bool": {
"must": [
{
"match_phrase": {
"child_fields.sentenceId": {
"query": "2",
"slop": 0,
"zero_terms_query": "NONE",
"boost": 1
}
}
}
],
"adjust_pure_negative": true,
"boost": 1
}
},
"path": "child_fields",
"ignore_unmapped": false,
"score_mode": "none",
"boost": 1
}
}
],
"adjust_pure_negative": true,
"boost": 1
}
}
],
"adjust_pure_negative": true,
"boost": 1
}
},
"_source": {
"includes": [
"child_fields.sentenceId"
],
"excludes": []
},
"stored_fields": "child_fields.sentenceId",
"aggregations": {
"child_fields@NESTED": {
"nested": {
"path": "child_fields"
},
"aggregations": {
"terms(field=child_fields.sentenceId,nested=child_fields)": {
"terms": {
"field": "child_fields.sentenceId",
"size": 10,
"min_doc_count": 1,
"shard_min_doc_count": 0,
"show_term_doc_count_error": false,
"order": [
{
"_count": "desc"
},
{
"_key": "asc"
}
]
}
}
}
}
}
}
还请大佬出手一把