0

I used this query curl localhost:9200/tweets/user/_search?size=25 on es 1.4.2 and I got the following result:

{
  "took": 5,
  "timed_out": false,
  "_shards": {
    "total": 6,
    "successful": 6,
    "failed": 0
  },
  "hits": {
    "total": 294633,
    "max_score": 1,
    "hits": [
...

with a list of documents.

When I ran the same query on es 2.3.0, I got same hits but the documents were completely different.

What could be the reason?

Animesh Pandey
  • 5,900
  • 13
  • 64
  • 130
  • Shard setup and the content of each shard, thus different term frequencies and different relevance scoring? – Andrei Stefan Apr 15 '16 at 18:41
  • I am using the default scoring as earlier. Running the query as above I get all the scores as `1`. I am not sure about the content of each shard – Animesh Pandey Apr 15 '16 at 18:52
  • @AndreiStefan I just run `curl localhost:9200/tweets/user/_search?size=25` – Animesh Pandey Apr 15 '16 at 19:40
  • 2
    Oh, so all the scores are equal. I bet that even if you reindex your documents in a separate index in the same 1.4.2 cluster (and if you have different IDs than the ones you already have) you will get different results. Anyway, the documentation says the order will be random: https://www.elastic.co/guide/en/elasticsearch/guide/master/_sorting.html#_sorting: "This will apply a constant score (default of 1) to all documents. It will perform the same as the above query, and all documents will be returned randomly like before, they’ll just have a score of one instead of zero." – Andrei Stefan Apr 15 '16 at 20:36
  • Also, why does it matter to you the order of these documents (since it's random)? – Andrei Stefan Apr 15 '16 at 20:39
  • @AndreiStefan I was about to apply custom scoring scripts on the documents but the simplest query gave random results so I got confused. Thanks for the link you mentioned. – Animesh Pandey Apr 15 '16 at 20:41
  • I think you can safely apply that. The random ordering based on constant score for all documents will not affect your custom scoring script. – Andrei Stefan Apr 15 '16 at 20:44

1 Answers1

0

The documentation says the order will be random:

This will apply a constant score (default of 1) to all documents. It will perform the same as the above query, and all documents will be returned randomly like before, they’ll just have a score of one instead of zero.

Andrei Stefan
  • 51,654
  • 6
  • 98
  • 89