Aggregate on a field


(Ohad Edelstain) #1

Can elasticsearch aggregate a field not just word by word but phrases?

Desired behaviour:

Got a field with a few words
Aggregate result:
key: "single word"
doc_count:number
...
key: "multi word" (phrase)
doc_count:number

Just to clarify:
I don't think that not_analyze is the way i want to go,
because i don't want a perfect match...
I want aggregation of one word, two word, three words...
Thanks!


(Christoph) #2

Maybe this would work using Shingle Token Filter in combination with Multi-fields, that way you can have various n-gram sizes indexed into different subfields and then do regular terms aggregations over them.


(system) #3