Hi everyone, i am facing a problem implementing nested query on my elasticsearch 5.6 cluster.
I've this mapping:
{
"my_test": {
"mappings": {
"co_product": {
"properties": {
"photos": {
"type": "keyword"
},
"specs": {
"type": "nested",
"properties": {
"value": {
"type": "keyword"
}
}
}
}
}
}
}
}
And this data:
[
{
"photos": [
"http://foto2.png",
],
"specs": [
{
"value": "Tornillo"
},
{
"value": "Dorado"
}
]
},{
"photos": [
"http://foto2.png",
],
"specs": [
{
"value": "Tornillo"
},
{
"value": "Plata"
}
]
}
]
I need a query to get a exactly the items that match with all the filters that i send, i tried like this:
"query": {
"nested": {
"path": "specs",
"query": {
"bool": {
"must": [
{"match": {"specs.value": "Tornillo"}},
{"match": {"specs.value": "Dorado"}}
]
}
}
}
}
But that brings me back an empty response.
I tried this way too:
"query": {
"nested": {
"path": "specs",
"query": {
"bool": {
"should": [
{"match": {"specs.value": "Tornillo"}},
{"match": {"specs.value": "Dorado"}}
]
}
}
}
}
But that brings me back all the items, and i just want the item that match exaclty.
Please i've headache trying....