Answer the question
In order to leave comments, you need to log in
How to search by occurrence in a string in ElasticSearch?
How to change the mapping/index so that the query #1("Ivan") finds the record "Ivanova Olga Ivanovna"?
Index:
PUT /test
{
"mappings": {
"properties": {
"title": {
"type": "text"
}
}
}
}
PUT /test/_doc/1
{
"title": "Иванова Ольга Ивановна",
}
GET /test/_search
{
"query": {
"multi_match": {
"query": "иван",
"fuzziness": 1,
"fields": ["title"]
}
},
"highlight": {
"fields": {
"title": {}
}
}
}
GET /test/_search
{
"query": {
"multi_match": {
"query": "иванов",
"fuzziness": 1,
"fields": ["title"]
}
},
"highlight": {
"fields": {
"title": {}
}
}
}
RESPONSE:
"highlight": {
"title": [
"<em>Иванова</em> Ольга Ивановна"
]
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question