Skip to content

IndexOperations#putMapping does not include the dynamic property #2478

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
anton-johansson opened this issue Feb 24, 2023 · 1 comment · Fixed by #2483
Closed

IndexOperations#putMapping does not include the dynamic property #2478

anton-johansson opened this issue Feb 24, 2023 · 1 comment · Fixed by #2483
Assignees
Labels
type: bug A general bug

Comments

@anton-johansson
Copy link

anton-johansson commented Feb 24, 2023

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).

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 24, 2023
@sothawo
Copy link
Collaborator

sothawo commented Feb 25, 2023

The created PutMappingRequest should indeed contain more than just the properties. Would be a nice opportunity to see if the json conversion vodoo is still needed for the create, this is from the first versions of the new Elasticsearch client.

@sothawo sothawo added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 25, 2023
@sothawo sothawo self-assigned this Feb 26, 2023
@sothawo sothawo added this to the 5.1 M3 (2023.0.0) milestone Feb 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants