Reputation: 3194
I have three documents, first: I have an empty images
object, second: I have a null in images.front
, and third: I have object in images.front
.
As follows:
[{
"images": {}
}, {
"images": {
"front": null
}
}, {
"images": {
"front": {
"id": 1
}
}
}]
How can I search only for the documents that have front
image (documents two and three, but not first)?
Many thanks :)
Upvotes: 3
Views: 876
Reputation: 4803
As far i know(i worked only till 1.7.2), document 1 and 2 will have same json structure in _source document of the elastic.As elasticsearch doesn't support null values.
So if you want to search for documents which have images , do a exists filters in the must bool filter.
Exists filter in elasticsearch
Upvotes: 1