I am try to find the average price of car based on condition of the car

But I don't get the result.

"aggregations": {
"car-condition": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": []
}

     GET /vehicles/_search
     {
        "aggs": {
            "car-condition": {
                      "terms": {
                            "field": "{condition.keyword}"
                      },
                     "aggs": {
                             "car-avg-price": {
                                     "avg": {
                                             "field": "price"
                                      }
                         }
                   }
           }
        
      }
  }

This looks like more of an ES question. Can you please post this in the ES discuss forums to get a faster answer,

http://discuss.elastic.co/c/elasticsearch

Thanks
Rashmi

Ok. Thank You Rashmi.

I believe this should be "field": "condition.keyword".

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