Random N documents for a match query

Hi there,

I need to get N random documents that have a given term in a string field.
I tried something like the following, but it is still giving me the documents in asc order.

curl -XPOST 'localhost:9200/_search?pretty' -d '{
  "query": {
    "function_score" : {
      "query" : {"match": {"body": "happy"}},
      "random_score" : { "seed" : 1234 }
    }
  }
}'

any idea, how to get random N documents.

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