I'm trying to disable _source as in my case the updated and reindex are unnecessary feature.
The issue is I cannot get any field when the _source is diabled.
I created a index like:
curl -XPUT http://localhost:9200/test1 -d '{"mappings":{"test":{"_source":{"enabled": false}}}}'
{"acknowledged":true}
and put a document in:
curl -XPUT http://localhost:9200/test1/test/1 -d '{"f1":"1111","f2":"222"}'
{"_index":"test1","_type":"test","_id":"1","_version":1,"created":true}
when try to get this document only the meta field returned
curl -XGET http://localhost:9200/test1/test/1
{"_index":"test1","_type":"test","_id":"1","_version":1,"found":true}
There is nothing wrong, Elasticsearch is working as expected. The field values are stored in the _source field and when you get a document this is what is returned. If you disable _source no fields will be stored and therefore will not be shown on a get request. You need to re-enable your _source field. Disabling the _source field is generally not recommend as is only useful in instances where you never need the stored values of the fields.
For insert performance concern. As elasticsearch generate lots of extra inform far beyond the docment itself, I'd like to disable them which feature I didn't need.
But seems the _source is the one I need.
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.