Hi guys,
I have a field which is keyword array:
e.g.
[]
["A"]
["A"]
["B"]
["A","B"]
if I do terms aggregation on this field, I will get
"A" : 3
"B" : 2
is there any way that can make the combination as the bucket key in result?
"A" : 2
"B" : 1
"A"&"B": 1
thanks!
dadoonet
(David Pilato)
May 13, 2020, 9:57am
2
I don't think you can with the current data structure.
What about generating instead:
"foo": "A"
"foo": "A"
"foo": "B"
"foo": "A&B"
That way you'll get back:
"A": 2
"B": 1
"A&B": 1
That being said, you can may be generate such a thing at search time (with a cost) using a painless script. See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#search-aggregations-bucket-terms-aggregation-script
1 Like
system
(system)
Closed
June 10, 2020, 9:57am
3
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.