I was looking for options to improve indexing performance and reduce disk space usage on our ES cluster. When I checked the documentation for the _source field, I saw the warnings mentioned there. However, it occurred to me that in some cases I use that to get additional fields for some of my queries. In case, I disable _source (knowing the consequences), is there another way to return additional fields?
As I see, docvalue_fields doesn't support text fields which is partly okay, but in case I'd need one with _source disabled, can I use fields?
Is it possible to use both of those in the same query?
Lastly, in case I don't need _source at all should I always include "_source": false in every query?
Yes. Default mapping created for string field will contain keyword field of type keyword. That will support docvalue. Use this if value is short in length. If the field value is source of html pages, use store = true instead. in which case you can retrieve it using stored_fields. See snipped below.
Both as in _source and docvalues? Then yes.
Yes. default value for _source in the request object is false in 7.8. For older version default was true. Not sure when it changed. But if you have turned off _source in mapping, it won't matter.
Nope, I meant "fields" and "docvalue_fields". I'm looking for the easiest way to drop "_source" while I can still get any field I want. I don't really see why I should store the original JSON and use that to retrieve a field that is indexed.
There are some indices where I can drop _source easily, however I won't be able to maintain each field's mapping individually.