# Compute a possible "max\_score" for a query

**URL:** https://discuss.elastic.co/t/compute-a-possible-max-score-for-a-query/185494
**Category:** Elasticsearch
**Tags:** painless
**Created:** [June 12, 2019, 6:00pm UTC](https://discuss.elastic.co/t/compute-a-possible-max-score-for-a-query/185494 "2019-06-12T18:00:47Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![robinalexandre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/robinalexandre/32/52181_2.png) [@robinalexandre](https://discuss.elastic.co/u/robinalexandre)
#### Post date: [June 12, 2019, 6:00pm UTC](https://discuss.elastic.co/t/compute-a-possible-max-score-for-a-query/185494/1 "2019-06-12T18:00:47Z")

</div>

Hi there,

I'm pretty new to the ElasticSearch eco-system and I need the community to help me.

I need to know if the results I get from a full-text search can be considered good or not. I saw the \_score depends on the query sent and cannot be used to determine if our results are relevant.  
After trying to find a workaround, I got an idea but it does not seem to work and I can't find why.

I try to execute a painless script to calculate the \_score of a "fake" document not indexed like that:

```
{
	"script":
	{
		"source": "_score"
	},
	"context": "score",
	"context_setup":
	{
		"index": _my_index,
		"document":
		{
			"text": "the cat ate the dog"
		},
		"query":
		{
			"more_like_this":
			{
				"fields": ["text"],
				"like": "the cat ate the dog",
				"min_term_freq": 1,
				"min_doc_freq": 1
			}
		}
}
}

```

What I expect is a maximum "theoretic" score. However I get a score even less big than the indexed documents which are not a perfect match. I thought it was because of the IDF used when processing the query was not the IDF calculated for all my indexed documents but I can't find why ...

Thanks

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 10, 2019, 6:00pm UTC](https://discuss.elastic.co/t/compute-a-possible-max-score-for-a-query/185494/2 "2019-07-10T18:00:47Z")

</div>

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