# Elasticsearch query\_string - getting more accurate score

**URL:** <https://discuss.elastic.co/t/elasticsearch-query-string-getting-more-accurate-score/184357>\
**Category:** Elasticsearch\
**Created:** [June 5, 2019, 12:38pm UTC](https://discuss.elastic.co/t/elasticsearch-query-string-getting-more-accurate-score/184357 "2019-06-05T12:38:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pastechecker](https://avatars.discourse-cdn.com/v4/letter/p/0ea827/32.png) [@pastechecker](https://discuss.elastic.co/u/pastechecker)\
**Post date:** [June 5, 2019, 12:38pm UTC](https://discuss.elastic.co/t/elasticsearch-query-string-getting-more-accurate-score/184357/1 "2019-06-05T12:38:16Z")

</div>

I would like to get the higher score as I will get closer to the 1:1 match with for what I am querying it.

For example:  
**I query for** : [s3-us-west-1.amazonaws.com](http://s3-us-west-1.amazonaws.com)  
**Destination document contains:** [s3-us-west-1.amazonaws.com/some](http://s3-us-west-1.amazonaws.com/some)  
and I get the score, for example 43.

If I will query again, but the **destination document would contain:** [s3-us-west-1.amazonaws.com/sometest/content/anyway](http://s3-us-west-1.amazonaws.com/sometest/content/anyway)  
I would get the score significantly smaller, like 22.

**My data in Elasticsearch contains:**

> ```
> {"url":"s3-us-west-1.amazonaws.com/some"}
> {"url":"s3-us-west-1.amazonaws.com/something/test"}
> 
> ```

**My query is:**

```
GET urls/_search
{
  "min_score": 20,
  "query":{
   "query_string":{
    "fields":["url"],
    "allow_leading_wildcard":"false",
    "minimum_should_match":"90%",
    "query":"s3-us-west-1.amazonaws.com"
   }
 }
}

```

**The result I get:**

> ```
> {
> "took" : 2,
> "timed_out" : false,
> "_shards" : {
> "total" : 5,
> "successful" : 5,
> "skipped" : 0,
> "failed" : 0
> },
> "hits" : {
> "total" : 1,
> "max_score" : 22.895481,
> "hits" : [
> {
> "_index" : "urls",
> "_type" : "doc",
> "_id" : "28ece442fea424d932fde545f447658c",
> "_score" : 22.895481,
> "_source" : {
> "url" : "s3-us-west-1.amazonaws.com/sometest/content/anyway"
> }
> }
> ]
> }
> }
> 
> ```

My final goal is to use such query in the Logstash Elasticsearch filter for enrichment using query\_template.  
Thank you for the suggestions.

---

<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 3, 2019, 12:38pm UTC](https://discuss.elastic.co/t/elasticsearch-query-string-getting-more-accurate-score/184357/2 "2019-07-03T12:38:18Z")

</div>

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