elasticsearch - How to retrieve more data from aggregation when array of items is aggregated? -
This question is related. The difference is that I try to collect "languages" on the field which is an array and there are several entries in it such as: {id: 1, name: "english"}
.
Here is a mapping:
Languages: Properties: Name: Type: "string" index: "not_analyzed" id: type: "long"
< Try to collect / pre>i like this:
aggs: languages: terms: field: "languages.id" aggs: languageName: terms: field: "languages {"Key": {"key": 175, "doc_count": 1, "language name": {"bucket": [{"key": "Latin", "Doc_count": 1}, {"key": "lingala", "doc_count": 1}, {"key": "Quechua", "doc_count": 1}, {"key": "t nested for some reasons All language names return for aggregation single So, how do I get language id ... I correct language name?
You have to use nested gathering, <">" "" "": " "" {"Field": "languages.id"}, "ags": {"languageName": {"terms": {"field": "languages.name"}}}}}}}}
Ensure that you have type = nested for "languages".
ex.
{... "language": {"Properties": {"Reseller": {"Type": "Nested" "Properties": {"Name": {"Type": "String"}, "id": {"type": "long"} }}}}}
Learn more @
Comments
Post a Comment