I have an Elastic Search data store where I am storing JSON data.
Say it has the following format:
{
"orderNumber": "1234"
"contactInformation": {
"firstName": "Jane",
"lastName" : "Doe",
"email": "[email protected]"
}
}
Lets say contactInformation.email is an optional attribute and the attribute itself might not occur in all records. I want to retrieve all records for which the attribute email is present. What is the query that I will use in Kibana console for this.
CodePudding user response:
You need to use the exists query
GET /_search
{
"query": {
"exists": {
"field": "contactInformation.email"
}
}
}