Boosting doc score based on the search

Hi
i have a a field that contains an ID and then description.

looks like this:
"37463448454 this is the description".

i'm using ngram based analyser on this field (while indexing).

i want the user to be able to search this filed using the id (or parts of it) or words from the description or both of them - that part works.

but when i look only by the specific id , the first result is not always the result with the specific id in it.

i'm using query_string and fuzziness 3 , ngram min 3 max 10

is there a way to boost the score for the doc that contains the specific id so when i search with by the id on that field it would show me the doc that contains the exact id i'm looking for?

how about using a multifield, where the second field is just using a standard analyzer. Then you could use a bool query with a should clause and a term query for the specific id, which would get boosted higher.

See https://www.elastic.co/guide/en/elasticsearch/reference/5.6/mapping-types.html#_multi_fields and https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-bool-query.html

Hi
Thanks for your reply
but i have no way of knowing what the user might search
he could search by the ID or by the description or by parts of them both

you could still put that whole query in the should part of the bool query with the standard analyzed field, it will still match for the whole term instead of the ngram analyzed one.

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