See the Elasticsearch documentation: [multi-fields|https://www.elastic.co/guide/en/elasticsearch/reference/5.5/multi-fields.html]
See also [HSEARCH-2215|https://hibernate.atlassian.net/browse/HSEARCH-2215]
The idea is to define additional fields that take the same input as other fields, but transform/store it differently. We could use a "source" or "derivedFrom" or "subFieldOf" attribute on @XXXField annotation:
{code} @FullTextField(name = “myField”, bridge = …) @KeywordField(subFieldOf = "myField", name = "sort", sortable = Sortable.YES, normalizer = "sortNormalizer") {code} Note that we would have to forbid the definition of a bridge on such field, because the copy happens automatically in the backend.
The backend APIs could expose something like this:
{code} schemaElement.field( "myField", f -> f.asLocalDate().toIndexFieldType() ) .subField( "sort", f -> f.asLocalDate().sortable( Sortable.YES ).normalizer( "sortNormalizer" ).toIndexFieldType() ) .createAccessor(); {code} Or maybe a better API could be designed while we address [ HSEARCH -3444 |https://hibernate . atlassian.net/browse/HSEARCH-3444] .
Original discussion: [ https://docs.google.com/document/d/ 16PAa\_\_LsxyLZcbW3q1MvgyIznh4ZnCYLupbNMXKMRds/edit#heading=h.gxh9craiaqrn|https://docs.google.com/document/d/ 16PAa__LsxyLZcbW3q1MvgyIznh4ZnCYLupbNMXKMRds/edit#heading=h.gxh9craiaqrn ] |
|