elasticsearch - Error:Class cast exception in elastic search while sorting buckets in aggregation -
error: classcastexception[org.elasticsearch.search. aggregations.support.valuessource$bytes$withordinals$fielddata cannot cast org.elasticsearch.search.aggregations.support.valuessource$numeric]}{[vthdfzputegmgr8mes_b9g]
my query:
_search { "size" : 0, "query" : { "filtered" : { "query" : { "dis_max" : { "tie_breaker" : 0.7, "queries" : [ { "bool" : { "should" : [ { "match" : { "post.body" : { "query" : "check", "type" : "boolean" } } }, { "match" : { "post.parentbody" : { "query" : "check", "type" : "boolean", "boost" : 2.0 } } } ] } } ] } } } }, "aggregations" : { "by_parent_id" : { "terms" : { "field" : "post.parentid", "order" : { "max_score" : "desc" } }, "aggregations" : { "max_score" : { "max" : {} }, "top_post" : { "top_hits" : { "size" : 1 } } } } }
i want sort buckets max_score
rather doc_count
default behaviour of elastic search. trying aggregate posts (which contains body , parentbody) parentid
, sorting buckets max_score
, in each bucket getting top_hits
. getting above error when sorted buckets defining max score aggregation. rest works if remove max_score
aggregation. every post object has parentid, body , parentbody. have used following references coding this:
elasticsearch aggregation: how sort bucket order https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-top-hits-aggregation.html#_field_collapse_example
tell me doing wrong? have shared query above.
Comments
Post a Comment