Answer the question
In order to leave comments, you need to log in
elasticsearch. Combined fields search
Hello Habr.
I use Elasticsearch to search CouchDB.
The search is carried out by full name. The database has an object with name fields. last, name .first, name.middle.
I'm looking like this:
{
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "Петров Иван Сергеевич",
"fields": [
"name.last",
"name.first",
"name.middle"
]
}
}
]
}
},
"filter": {},
"from": 0,
"size": 20
}
Answer the question
In order to leave comments, you need to log in
Try something like this:
{
"query": {
"bool": {
"should": [
{
"match": {"name.last": "Петров Иван Сергеевич"}
},
{
"match": {"name.first": "Петров Иван Сергеевич"}
},
{
"match": {"name.middle": "Петров Иван Сергеевич"}
}
],
"minimum_number_should_match": 1
}
},
"filter": {},
"from": 0,
"size": 20
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question