elasticsearch - Average of top n terms -


in index documents have keyword, rank , timestamp. rank keyword may differ time time. means dataset may this:

{"keywords": "piano", "rank" 1, "timestamp": 1437642812} {"keywords": "piano", "rank" 2, "timestamp": 1437642813} {"keywords": "electric guitar", "rank" 5, "timestamp": 1437644326} 

i average rank of top 500 occuring keywords. cannot find out how this.

my current try-outs seem give average results individually, want average entire dataset of top results of aggregation.

post _search {     "aggs": {         "top_keywords": {             "terms": {                 "field": "keywords",                 "size": 1             }         },         "avg_rank": {             "avg": {"field": "rank"}         }     },     "size": 0 } 

attempts using top_hits haven't been successful either.

elsewhere have read splitting query separate queries, first retrieving list of top keywords , in second query filter documents keywords returned first query. feed query kibana, hope not required.

these related topics don't provide satisfying answer either.

can point me in right direction?

an elasticssearch developer told me not possible:

in current version not possible, pipeline aggregations coming in version 2.0 able use avg_bucket aggregation this: https://www.elastic.co/guide/en/elasticsearch/reference/master/search-aggregations-pipeline-avg-bucket-aggregation.html

in mean time need aggregation top 500 terms , perform average calculation on client side

and makes impossible show data in kibana:

yes work in 2.0 requests straight elasticsearch. however, take time functionality added kibana interface. kibana team thinking how add though

source: https://discuss.elastic.co/t/average-of-top-n-terms/26165


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -