Answer the question
In order to leave comments, you need to log in
How to search for a part of a word in ElasticSearch so that the second word is already searched for in a specific record?
There is a task, a directory of employees, you need to search for it
. For example, there are 2 entries:
1
fname = Maria
sname = Ivanova
2
fname = Maxim
sname = Plyushkin
We write Ma find 1 and 2 record
We write Ma Plus find 2 record
Answer the question
In order to leave comments, you need to log in
I don’t know how compared to nGrams, you need to test, but there is an option to use fuzzy queries :
GET /_search
{
"query": {
"fuzzy" : {
"fname" : {
"value" : "ма",
"fuzziness" : 10, // этот параметр для вашей задачи нужно выставлять повыше
"prefix_length" : 2, // будет равняться кол-ву уже введенных символов
"max_expansions": 100 // также выставляется повыше
}
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question