Hi all,

Have you ever tried to order the bucket by field _score of documents  given
a query?

I took example from http://blog.qbox.io/elasticsearch-aggregations and make
the query:
curl -XPOST "http://localhost:9200/sports/athlete/_search"; -d '{
    "query" : {
            "match" : { "sport" : "baseball" }
        },

   "size": 0,
   "aggs": {
      "sport": {
         "terms": {
            "field": "sport",
            "size": 5,
            "order" : { "max_score" : "desc" }
         },
         "aggs" : {
             "max_score" : { "max" : { "field" : "_score" } }
         }
      }
   }
}'

However in the response i see:

    "aggregations": {
        "sport": {
            "buckets": [{
                "key": "baseball",
                "doc_count": 16,
                "max_score": {
                    "value": null
                }
            }]
        }
    }
I know that the 1st document in result list has score 2.098612 for that
query so why max_score is null in aggregations?

Thanks for your help.
Toan.

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CAPUM1c21LCuLaveBXS38kd3fSmw-PENKgSqu9z3fQmd5L2C6JQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to