Skip to content

Spring data elasticsearch and @JsonRootName #33

Open
@takearun

Description

@takearun

Hi,

I use spring-boot-starter-data-elasticsearch dependency in my Java spring project to query ES 2.4.0

My json's look like this,

{
   "event":{
      "eventName":"Man U vs Arsenal",
      "eventDateTime":"Mon 24 Oct 12:00"
   }
}

To avoid having to declare an empty "event" POJO wrapper, I use @JsonRootName(value="event") to mark that there's a root element in my POJO and I have also specified this in my application.properties,
spring.jackson.deserialization.UNWRAP_ROOT_VALUE=true

The search is happening fine but the root element declaration does not take effect and results in objects with just nulls.

Can you please help.

Thanks,
Arun

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions