Elasticsearch query_string - getting more accurate score

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
Destination document contains: 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
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.

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