Description
In Spring Data OpenSearch [1], which is built on top of Spring Data Elasticsearch, we are running into cases where both projects differ in incompatible ways. One of such cases is supported mapping field types (baked by org.springframework.data.elasticsearch.annotations.FieldType
), for example:
Flattened("flattened"), //
would have to become
Flat_Object("flat_oblect"), //
for OpenSearch.
One of the simplest (but no necessarily good) ways to support Elasticsearch and OpenSearch is to maintain the union of both (Flattened
and Flat_Object
): solves the problem but adds confusion.
One of (arguably) better alternatives is to add optional mappedName
attribute to @InnerField
and @Field
annotations (and model classes respectively), to address the possible divergence, for example:
@Field(type = FieldType.Flattened, mappedName = "flat_oblect") String flattenedField;
It would require a bit more work for OpenSearch users but not the Elasticsearch ones. The change would be non-breaking (defaults to "" and FieldType::getMappedType
) and work seamlessly.
@sothawo I am wondering if you (or/and other maintainers) would be open to accept such feature proposal (I will be taking care of all the necessary work if greenlighted).
Thank you!
[1] https://github.com/opensearch-project/spring-data-opensearch