Hi Team,
I'm reaching out query that I have, I want a query which returns the field with any random value inside it and filter out the empty records.
For eg: In my case, I have a FileContent.content field and it has values for that field and few doesn't have any value for it and it is empty. I figured out the query to filter out the empty values l, but I want a query which gives me the Filecontent.content field which has values in it. I've been trying alot on this. Can someone please help on this?
Here is the query I tried for filtering out the empty values :
{
"query": {
"bool": {
"should": [
{
"bool": {
"must_not": [
{
"exists": {
"field": "FileContent.content"
}
}
]
}
},
{
"term": {
"FileContent.content": ""
}
}
]
}
}
}
The above query is working perfectly fine for empty records, but I need a query which gives me the FileContent.content with a value inside it i.e; non empty.
Can you please help me on this?
I've been stuck since a long time.
Thanks in advance and appreciate you if you can really help me on this.
Thanks for the input. But the above query is giving the empty records. This query is working perfectly for non-empty records :
{"query": {
"bool": {
"must": {
"exists": {
"field": "Description"
}
},
"must_not": {
"term": {
"Description.keyword": ""
}
}
}
}
}
The above query eliminates all the empty records and process only non-empty records
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.