I want to only extract test_2.txt data from this. For same, I wrote below query:
curl -X GET "localhost:9200/_search" -H 'Content-Type: application/json' -d'
{
"_source": false,
"query" : {
"terms" : {"attachments" : {["filename" : "test_2.txt"]}}
}
}
'
But I am getting blank results in hits key of the returned results.
Can anyone please help me in how to get those using the "terms" query?
Please format your code, logs or configuration files using </> icon as explained in this guide and not the citation button. It will make your post more readable.
Or use markdown style like:
```
CODE
```
This is the icon to use if you are not using markdown format:
There's a live preview panel for exactly this reasons.
Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.
Please update your post.
Thank you for your valuable suggestion for posting on ES forum. Tried running above query, it throws below error:
{"error":{"root_cause":[{"type":"parsing_exception","reason":"[terms] query does not support [attachments.filename]","line":4,"col":41}],"type":"parsing_exception","reason":"[terms] query does not support [attachments.filename]","line":4,"col":41},"status":400}
Query didn't throw an error, but gave blank output in "hits". As previously suggested by you, attach 1 attachment per doc if need to fetch 1 attachment per request.
Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.
A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.
Probably here you did not use a keyword data type for this field.
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.