Given the following mapping I need to get results that match the following criteria
- Exact match on first name, last name, date_of_birth and Active = true OR
- Exact match on first name, last name, Active = true and 1 email out of possible multiples OR
- Exact match on first name, last name, Active = true and 1 traveldocument number out of possible multiples
Where email and travel document can refer to a collection of items.
{
"profile":{
"properties":{
"date_of_birth":{
"type":"date",
"store":"no"
},
"first_name":{
"type":"string",
"store":"no"
},
"last_name":{
"type":"string",
"store":"no"
},
"email":{
"type":"string",
"store":"no"
},
"active":{
"type":"string",
"store":"no"
},
"travel_document":{
"properties" : {
"countryOfCitizenship" : {"type" : "string"},
"countryOfIssue" : {"type" : "string"},
"expirationDate" : {"type" : "date"},
"nationality" : {"type" : "string"},
"number" : {"type" : "string"},
"addressLines" : {"type": "string"},
"issuedForAreaCode" : {"type": "string"},
"type" : {"type": "string"}
}
}
}
}
}
Is there a way I can execute this kind of search in elasticsearch? Can I do this with Nested Queries ?