In our document "Product" mapping, we have a field object called "codes"- example:
"codes" : [
{
"code" : "1234",
"place_id" : null
},
{
"code" : "4504",
"place_id" : 29
}
]
We are trying to write a query to retrieve all documents that have a codes.place_id that is either null, or another number.
However, this query is not returning any results (only a portion of it below):
"filter": {
"and": [
{
"or": [
{
"missing": {
"field": "codes.place_id",
"existence": true,
"null_value": true
}
},
{
"in": {
"codes.place_id": [
3
]
}
}
]
}
]
}
If I change the "in" clause to match the document's place_id of 29, then it returns results properly. However, the original query should return results because that document has one code with a place_id of null, right?
Here is the mapping:
{
"product": {
"properties": {
"codes": {
"properties": {
"code": {
"type": "string",
"index": "not_analyzed",
"fields": {
"analyzed": {
"type": "string"
}
}
},
"place_id": {
"type": "long"
}
}
}
}
}
}