Hy everyone!
I'm new to the elastic universe and I have a question about a query. I'll try to describe it here:
I have a document called 'store' with several stores registered and within each store item a list of customers:
loja {
nome,
telefone,
email,
clientes : [
{
nomeCliente,
telefone,
email
}
]
}
I need a query where I would have to return at least 1 pair of customers from the same registered store
For example:
I research 'Ana Maria', 'Sandra Maria' and 'Alberto Braz', where I would need to return the stores that have [Ana Maria and Sandra Maria] or [Ana Maria and Alberto Braz] or [Sandra Maria and Alberto Braz].
I did the search according to the dsl below, but the minimum_should_match clause is not respecting the limit of 2 m and returning results with only 1 record found.
Am I doing something wrong in the query?
Could you help me out on this one?
Query:
{
"query": {
"bool": {
"must": [
{
"nested": {
"query": {
"bool":{
"should": {
"match": {
"clientes.nomeCliente" : {
"query" : "ANA MARIA",
"type" : "phrase",
"operator": "and",
"slop" : 40
}
}
},
"should": {
"match":{
"clientes.nomeCliente" : {
"query" : "SANDRA MARIA",
"type" : "phrase",
"operator": "and",
"slop" : 40
}
}
},
"should": {
"match":{
"clientes.nomeCliente" : {
"query" : "ALBERTO BRAZ",
"type" : "phrase",
"operator": "and",
"slop" : 40
}
}
}
},"minimum_should_match": 2
},
"path": "clientes",
"inner_hits" : {
"size" : 10
}
}
}
]
}
}
}