Skip to content

IndexOperations#putMapping does not include the dynamic property #2478

Closed
@anton-johansson

Description

@anton-johansson

If I let Spring Boot automatically create my index and its mapping, it respects the @Document(dynamic = Dynamic.False) attribute. But if I "manually" set my mapping via IndexOperations#putMapping, the dynamic property is ignored.

Looking at this method, I think something is missing here:
https://github.com/spring-projects/spring-data-elasticsearch/blob/main/src/main/java/org/springframework/data/elasticsearch/client/elc/RequestConverter.java#L241

Compare that with the create method:
https://github.com/spring-projects/spring-data-elasticsearch/blob/main/src/main/java/org/springframework/data/elasticsearch/client/elc/RequestConverter.java#L151

Here, we use JSON to convert it, and it seems to be included there.

I'm currently creating the index (without mapping), then utilizing IndexOperations#putMapping to add the mapping. I guess I should be including the mapping when I create the index, but it's difficult to do so without "losing" the power of this library (Spring Boot Elasticsearch).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions