Hi there !
I'm actually working on a full text search (and quite new to it).
I'd like to give to the user the results which best fit the query string, and do it as the user types characters.
I've created a multi match query like this:
GET /streams/_search
{
"query": {
"multi_match": {
"query": "event",
"fields": [ "*_keywords", "name^2" ]
}
}
}
I've also created a custom autocomplete analyzer, exactly like the one described here (except I used a ngram filter instead of edge ngram):
https://www.elastic.co/guide/en/elasticsearch/guide/current/_index_time_search_as_you_type.html
I have declared the analyzer in the index, and used it in the mapping of my document type, as described in the article.
When calling the search as mentioned above, I obtained the results I'm looking for, but I'd like the score to be more accurate.
Let's say I create these documents:
PUT /streams/stream/123
{
"name": "Event test"
}
PUT /streams/stream/456
{
"name": "Eventually consistent"
}
PUT /streams/stream/789
{
"name": "Another Event"
}
And that I'm looking for the term "event", the three documents obtain the same score (either in best fields or in most fields query type). I can understand it.
But I would like to improve the score so that document with the name "Eventually consistent" has a lower score than the others. Previously, I was using only the default analyzer (with no autocomplete possibility) and the score was different depending on the weight of the expression is in the field.
So my question is : How can I have a more accurate score in this situation?
I'm quite new to ES, so I might have missed something important...
Thanks !