Hi,
I have documents in a collection as per following structure.
Document 1 = { "A":[
{
"type": "1",
"method": "auto",
"value": "some data"
},
{
"type": "2",
"method": "auto",
"value": "some data"
},
{
"type": "3",
"method": "auto",
"value": "some data"
}],
...
...
}
Document 2 = { "A":[
{
"type": "1",
"method": "manual",
"value": "some data"
},
{
"type": "2",
"method": "auto",
"value": "some data"
},
{
"type": "3",
"method": "manual",
"value": "some data"
}],
...
...
}
Document 3 = { "A":[
{
"type": "1",
"method": "manual",
"value": "some data"
},
{
"type": "2",
"method": "manual",
"value": "some data"
},
{
"type": "3",
"method": "auto",
"value": "some data"
}],
...
...
}
On these documents, I want to query two fields in array A..
Example 1: if I query "A.type":"1" AND "A.method":"manual", I should get document 2 and document 3 in return.
Example 2: if I query "A.type":"2" AND "A.method":"auto", I should get document 1 and document 2 in return.
Example 3: if I query "A.type":"2" AND "A.method":"manual", I should get only document 3 in return.
Is there a way to achieve this in ElasticSearch?