Elasticsearch creates some implicit fields when indexing, and so does Hibernate Search:
* {{_index}} (the name of the index) * {{_entity_type}} (the name of the indexed entity type) * etc.
It would be nice to be able to refer to these fields in the Search DSL, even though they weren't declared anywhere, e.g.:
{code:java} AggregationKey<Map<String, Long>> countsByEntityKey = AggregationKey.of( "countsByEntity" );
SerachResult<MyEntity> result = searchSession.search(MyEntity.class).extension(ElasticsearchExtension.get()) .where(...) .aggregation(countsByEntityKey, f -> f.terms() .field( "_entity_type", String.class )) .fetch( 20 ); {code}
Note we do NOT want the same for the internal Lucene fields: those are private and should not be relied on by application developers. |
|