I'm trying to query basically three AND's: "fields.name": "Date One" AND "fields.value": "2015-07-10" AND "filds.value_full": "Jhon Benny"
Here's what I tryed before:
{
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"nested": {
"path": "fields",
"filter": {
"bool": {
"must": [
{
"term": {
"fields.name": "Date One"
}
},
{
"term": {
"fields.value": "2015-07-10"
}
}
],
"should": [
{
"term": {
"fields.value_full": "John Benny"
}
},
{
"term": {
"fields.value": "Client"
}
}
]
}
}
}
}
}
}
}
And my JSON is this one here:
{
"id": 1,
"collection": "Document",
"data_cad": "2015-07-10",
"type_document": "Contract",
"confidencial": "false",
"fields": [
{
"name": "Date One",
"value": "2015-07-10"
},
{
"name": "Date Two",
"value": "2017-07-10"
},
{
"name": "Client",
"value_full": "Jhon Benny"
},
{
"name": "Value of Contract",
"value_contract": 520.50
}
]
}
If I just leave "fields.name": "Date One" AND "fields.value": "2015-07-10" it works fine, but as I wrote here, I get no results back.