Below is my mapping for index:
{
"properties" : {
"solutions" : {
"type" : "nested",
"properties" : {
"deliverySkills" : {
"type" : "nested",
"properties" : {
"mappingList" : {
"type" : "text"
},
"name" : {
"type" : "text"
}
}
}
}
}
}
}
Mine data for above mapping is:
{
"solutions" : [
{
"deliverySkills" : [
{
"name" : "Python",
"mappingList" : [ ]
},
{
"name" : "JSON",
"mappingList" : [ ]
},
{
"name" : "API design",
"mappingList" : [
"Design API"
]
}
]
},
{
"deliverySkills" : [
{
"name" : "HTTP",
"mappingList" : [ ]
},
{
"name" : "HTTPS",
"mappingList" : [ ]
},
{
"name" : "JavaScript",
"mappingList" : [ ]
}
]
}
]
}
I tried with the below query:
{
"query": {
"nested": {
"path": "solutions",
"query": {
"bool": {
"must": [
{
"nested": {
"path": "solutions.deliverySkills",
"query": {
"terms": {
"solutions.deliverySkills.name": ["JSON", "Python"]
}
}
}
}
]
}
}
}
}
}
But it's not working. When i tried with the match instead of terms than it is working but i need to use the terms as i have to check from the array