Elasticsearch is requesting too many results

I am trying to set up a simple search that returns me simple results with a custom order, the ordering I get is perfectly dependent on the custom rating.

The problem is that for this request

"query": {
    "query_string": {
        "query": query_term,
        "fields": ["name_auto"],
    }
}

      

NOTE: name_auto - Edge Ngr field on resist

I always get the result set as well if the query doesn't make any sense.

Example:

I have an elastcisearch index populated with the name of all android apps. If I search for a person , I will return all the results associated with it, sorted by the number of comments in the play store, menans [facebook, facebook messenger, ...]

The problem is that when I ask for something like faceomeuselesschars , I still get the same results as before, but of course there is nothing that matches "someuselesschars".

Can anyone help

+3


source to share


1 answer


ElasticSearch will always return results that match your query, even if the score for those results is low. Your query for "facesomeuselesschars" will match anything that has a "face" in it because of your ngrams (for example, the first four characters of your query will match multiple tokens in your index).

The rest of the characters in your query will simply decrease the return score, but not prevent it from being returned.



If you want to set the minimum score a score should achieve, you can use the min_score parameter .

+2


source







All Articles