Closed
Description
Hello,
I've been trying to find all documents that contains a field with an empty string value (_textContent
) inside my index using the missing
filter. But I think that this filter doesn't treat empty strings as a null value.
Is this a bug, or the intended behavior for this filter? If it is like this by design, may I suggest adding an empty
filter, if that's even possible?
As a plus, I'll post the mapping that I'm currently using, the document that contains the empty string field and the query that I'm trying to run:
Mapping:
{
"documents": {
"mappings": {
"document": {
"properties": {
"_contratante": {
"type": "string"
},
"_dateFields": {
"type": "nested",
"properties": {
"id": {
"type": "string",
"index": "not_analyzed"
},
"value": {
"type": "date",
"format": "dateOptionalTime"
}
}
},
"_indexadoPor": {
"type": "string"
},
"_textContent": {
"type": "string"
},
"_textFields": {
"type": "nested",
"properties": {
"id": {
"type": "string",
"index": "not_analyzed"
},
"value": {
"type": "string"
}
}
},
"_tipoDocumento": {
"type": "string"
}
}
}
}
}
}
Document:
{
"_index": "documents",
"_type": "document",
"_id": "xxx",
"_version": 1,
"found": true,
"_source": {
"_id": "xxx",
"_contratante": "xxx",
"_tipoDocumento": "xxx",
"_indexadoPor": "xxx",
"_dateFields": [
{
"id": "538730ece4b0d13600208d7a:2",
"value": 1404183600000
}
],
"_textFields": [
{
"id": "538730ece4b0d13600208d7a:0",
"value": "xxx"
},
{
"id": "538730ece4b0d13600208d7a:1",
"value": "xxx"
},
{
"id": "538730ece4b0d13600208d7a:3",
"value": ""
},
{
"id": "538730ece4b0d13600208d7a:4",
"value": "xxxx"
}
],
"_textContent": ""
}
}
Query:
{
"query": {
"filtered": {
"filter": {
"missing": {
"field": "_textContent"
}
}
}
}
}
Thanks a lot for the amazing tool developed here!
Metadata
Metadata
Assignees
Labels
No labels