Im doing a query that returns like 70k documents (I need all of them, and Im currently using scan & scroll)
What happens is that the response is very large (2 MB and we alredy reduced it from 6 MB). We alredy filtered the fields we needed, and since the query is only called from an API we reduced the name of the properties.
What i can see is that every document in the array "hits" has the following default fields that i really dont need them:
Is there a way to remove them so i can have the following structure:
"hits" : [
{
"_source": {
...
}
},
{
"_source": {
...
}
}
]
Thanks for reading! I will appreciate your help!
Yes, you can use response filtering and the filter_path
parameter, provided you're using ES 1.6 or later.
curl -XGET 'localhost:9200/_search?pretty&filter_path=hits.hits._source'
You can even specify the just the fields you want
curl -XGET 'localhost:9200/_search?pretty&filter_path=hits.hits._source&_source=title,name'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With