Best way to do a top strings query?


(Casie Owen) #1

Hi,

We want to be able to do a "top strings" (that's my naming) query. Like a top terms, but want the top entire strings in a field rather than the terms. I followed the instructions in this post and reindexed the data with the field as not_analyzed. After doing that, the query below does return the top strings:

GET indexname*/_search
{
"size": 0,
"aggs": {
"top-phrases-aggregation": {
"terms": {
"field":"contentAnalyzed",
"size":20
}
}
}
}

So, I've got what I need, but I'm wondering if there are other/better ways to do this?

Thanks,
Casie


(David Pilato) #2

I don't believe so. Aggregation is the right way to go IMHO.


(Casie Owen) #3

Thanks for the quick reply!


(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.