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

**URL:** <https://discuss.elastic.co/t/elasticsearch-v5-0-0-objectmapper-don-t-have-writevalueasbytes/65744>\
**Category:** Elasticsearch\
**Created:** [November 11, 2016, 2:21am UTC](https://discuss.elastic.co/t/elasticsearch-v5-0-0-objectmapper-don-t-have-writevalueasbytes/65744 "2016-11-11T02:21:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevinZ](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kevinz/32/13242_2.png) [@kevinZ](https://discuss.elastic.co/u/kevinZ)\
**Post date:** [November 11, 2016, 2:21am UTC](https://discuss.elastic.co/t/elasticsearch-v5-0-0-objectmapper-don-t-have-writevalueasbytes/65744/1 "2016-11-11T02:21:31Z")

</div>

I'm using `elasticsearch` (v5.0.0) in java application. I can't find `writeValueAsBytes()` function.  
 ![](https://us1.discourse-cdn.com/elastic/original/2X/f/fc65d5eeb52823b1ef0f7b70584e8ba78ff5da13.png)

But [Java Api](https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-docs-index.html) have similar example.

 ![](https://us1.discourse-cdn.com/elastic/original/2X/8/8feaa38f9592bcfa92e07e642c1417cb3ba8b2aa.png)

This is all functions in `ObjectMapper` class:

 ![](https://us1.discourse-cdn.com/elastic/original/2X/9/9d62e464467ef6e8d2a23c457fb3710c7be997b9.png)

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [November 14, 2016, 8:22am UTC](https://discuss.elastic.co/t/elasticsearch-v5-0-0-objectmapper-don-t-have-writevalueasbytes/65744/2 "2016-11-14T08:22:12Z")

</div>

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:

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

```

(See [mvnrepository.com](http://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind/2.8.1) for the syntax of other build systems).

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

Daniel

---

<div class="post-metadata">

**Author:** ![kevinZ](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kevinz/32/13242_2.png) [@kevinZ](https://discuss.elastic.co/u/kevinZ)\
**Post date:** [November 14, 2016, 9:10am UTC](https://discuss.elastic.co/t/elasticsearch-v5-0-0-objectmapper-don-t-have-writevalueasbytes/65744/3 "2016-11-14T09:10:13Z")

</div>

Thanks! 🙂 @danielmitterdorfer

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 12, 2016, 9:10am UTC](https://discuss.elastic.co/t/elasticsearch-v5-0-0-objectmapper-don-t-have-writevalueasbytes/65744/4 "2016-12-12T09:10:28Z")

</div>

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