0
@Bean
public ElasticsearchRestTemplate elasticsearchRestTemplate() {
    return new ElasticsearchRestTemplate(elasticsearchClient(), entityMapper());
}

@Bean
@Override
public EntityMapper entityMapper() {
    //Override the default Object mapper with this
    //Just to remove extra register module

    DefaultEntityMapper defaultEntityMapper = new DefaultEntityMapper(elasticsearchMappingContext());
    try {
        Field field = defaultEntityMapper.getClass().getDeclaredField("objectMapper");
        field.setAccessible(true);
        field.set(defaultEntityMapper, getObjectMapper());
    } catch (Exception e) {
        e.printStackTrace();
    }
    return defaultEntityMapper;
}

This EntityMapper is deprecated , what should be the alternative to use as I am getting mappingInstantiationException in my code , while building es queries and getting output from that

I have tried ElasticSearchConverter , but it not helps me

0

Browse other questions tagged or ask your own question.