Skip to content

Add support for field mappings containing dots #2502

Closed
@olada

Description

@olada

Elastic supports storing values in fields which contain dots (e.g. "foo.bar") (see elastic/elasticsearch#15951).

Unfortunately, spring-data-elasticsearch does not seem to support mapping such dot-containing field values using the @Field-annotation.

Cause is following lines:

if (!fieldName.contains(".")) {
return target.get(fieldName);
}

The dot "." is (understandably) used for navigating the object graph.
Unfortunately the @Field-annotation does not allow overriding such behaviour (e.g. with a "navigateObjectGraphUsingDot=false" parameter or something similar).

Steps to reproduce:

  • Store document containing a field which contains a dot (e.g. "foo.bar")
  • Create document mapping using spring-data-elasticsearch using @field("foo.bar")
  • Read documents with a repository

Behaviour:
The value of the entity which is mapped with @field("foo.bar") is null and does not contain the actual value from the elastic document

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions