diff --git a/Custom-ObjectMapper.md b/Custom-ObjectMapper.md new file mode 100644 index 0000000..23d493b --- /dev/null +++ b/Custom-ObjectMapper.md @@ -0,0 +1,36 @@ +How to use custom ObjectMapper? + +1. Create new Class and implement Interface EntityMapper +``` +public class CustomEntityMapper implements EntityMapper { + + public CustomEntityMapper(){ + //custom configuration/implementation (e.g. FasterXML/jackson) + } + + @Override + public String mapToString(Object object) throws IOException { + //mapping Object to String + return null; + } + + @Override + public T mapToObject(String source, Class clazz) throws IOException { + //mapping String to Object + return null; + } +} +``` +2. Define new bean and inject it into ElasticsearchTemplate +``` + + + + + + +``` +3. Done + +Default implementation for EntityMapper used in project can be found here https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/DefaultEntityMapper.java \ No newline at end of file