Has the support of whether to store the field in _source or not removed from @GenericField annotation? Is this by design or can it change in future releases?
All fields are included in the source by default in Elasticsearch. I am not sure there is a way to control this on a per-field basis.
If you mean support for projections, it can be enabled with @GenericField(projectable = Projectable.YES)
.
So I implemented a custom TypeBinder annotation which helps me in mimicking the _everything field behaviour, I read fields marked with @GenericField annotation and populate this custom field with their data. Now for some fields, I actually don’t require them in the _source of document, since they are really large strings and I have already dumped them in the _everything field, so was just looking for a way to achieve that. I might be remiss with my memory, but I thought there was a store = Store.YES kind of attribute for the annotation in some previous version(s).
store = Store.YES
was only a hint to Hibernate Search for the Elasticsearch backend in Hibernate Search 5. It did not change the way information was stored. That backend was experimental
When indexing, the _source
is populated whatever you do. There is no way to control that in Hibernate Search. I suppose we could exclude fields from the _source
at indexing time (I just discovered that feature), but that definitely wasn’t implemented in Hibernate Search 5.
In any case, when searching, Hibernate Search will use _source
filtering: it will only fetch the fields that it really needs for projections (by default, none).
So excluding fields from the _source
at indexing time (as mentioned above) will only affect storage space, not the amount of data transferred over the network during searches. I suppose this is what you’re after? Note that the Elasticsearch documentation recommends adjusting the compression level instead of altering the _source
.