Elasticsearch remove default fields from search’s response body
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:
_index (we only request on one index)
_type (we only request on one type)
_id (we alredy have this on a field)
_score (we are not scoring)
Is there a way to remove them so i can have the following structure:
“hits” : [
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'
- Database Administration Tutorials
- Programming Tutorials & IT News
- Linux & DevOps World
- Ebook Reviews
- PES Matches, Skills & News