S
S
Serg-shumakov2014-10-26 19:51:07
Search engines
Serg-shumakov, 2014-10-26 19:51:07

How to sort by query distance from the beginning of the string?

I'm trying to achieve more or less sane results using elasticsearch.
Task: instant search as you enter a query (search hints).
Request example:

{
           "query": {
             "simple_query_string": {
                "query" : "медицин*",
                "fields" : ["name"],
                "default_operator" : "and",
                "analyzer": "ru"
             }
           }
 }

Answer:
Скорая медицинская помощь
Медицинские комиссии
Медицинское оборудование и инструмент
Медицинская мебель
Фонды обязательного медицинского страхования
Многопрофильные медицинские центры
Медицинские пиявки – продажа / производство косметики
Медицинские приборы и аппараты
Ремонт медицинского оборудования и инструментов
Медицинские лаборатории

Question: Why is "Ambulance" higher than "Medical Commissions"? How to make the results with the occurrence of "medics" first, and then all the rest in order of distance from the beginning of the line.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Polushkin, 2015-02-12
@dmitry-polushkin

span_first + boost
www.elasticsearch.org/guide/en/elasticsearch/refer...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question