Random_score query brought down ES 5.5 cluster

This question is similar to this one:

The difference between the tickets is that I have intentionally specified size parameter. Index contains little more than 8 billions of documents. Here's my query:

{
    "version": true,
	"size": 5000,
	"query": {
		"function_score": {
			"query": {
				"bool": {
					"must": {
						"match_all": {}
					},
					"filter": {
						"range": {
							"updated": {
								"lte": "1556015239000"
							}
						}
					}
				}
			},
			"functions": [{
				"random_score": {
					"seed": 0
				}
			}]
		}
	}
}

My question is why did this happen?

size: 5000 only returns 5000 documents in the search response (which also is a lot and you should consider using scroll searches). However in order to get those 5000 documents the script score query needs to be executed against every hit that matches the query in the function score, which may be far more than those 5k.

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