Elasticsearch v5.0.0 ObjectMapper don’t have writeValueAsBytes()?


#1

I'm using elasticsearch (v5.0.0) in java application. I can't find writeValueAsBytes() function.

But Java Api have similar example.

This is all functions in ObjectMapper class:


Elasticsearch v5.0.0 ObjectMapper don't have writeValueAsBytes()?
(Daniel Mitterdorfer) #2

Hi @kevinZ,

you are using org.elasticsearch.index.mapper.ObjectMapper instead of com.fasterxml.jackson.databind.ObjectMapper. You need to add the following dependency to your project's build.gradle file:

compile "com.fasterxml.jackson.core:jackson-databind:2.8.1"

(See mvnrepository.com for the syntax of other build systems).

Unfortunately, the docs fail to mention that; we'll correct it. Thanks for spotting it.

Daniel


#3

Thanks! :slight_smile: @danielmitterdorfer


(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.