# Server and client errors, when connecting to Elasticsearch

**URL:** <https://discuss.elastic.co/t/server-and-client-errors-when-connecting-to-elasticsearch/49703>\
**Category:** Elasticsearch\
**Created:** [May 10, 2016, 7:53pm UTC](https://discuss.elastic.co/t/server-and-client-errors-when-connecting-to-elasticsearch/49703 "2016-05-10T19:53:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim\_Washington](https://avatars.discourse-cdn.com/v4/letter/t/73ab20/32.png) [@Tim\_Washington](https://discuss.elastic.co/u/Tim_Washington)\
**Post date:** [May 10, 2016, 7:53pm UTC](https://discuss.elastic.co/t/server-and-client-errors-when-connecting-to-elasticsearch/49703/1 "2016-05-10T19:53:10Z")

</div>

Hi there,

I'm running elasticsearch "_stable 2.1.1, HEAD_". When running `./bin/elasticsearch`, everything's fine until I try to to connect to it. Using the stream " **someindex/ledger**" and key " **somekey**", I get the below server and client errors. I'm using Samza's [TransportClientFactory](http://org.apache.samza.system.elasticsearch.client.TransportClientFactory), that I expect creates a client that connects to an ES cluster.

Elasticsearch gives me this error:  
[http://pastebin.com/Ucnsc9Rj](http://pastebin.com/Ucnsc9Rj)

And my client gives me this error:  
[http://pastebin.com/7x9zWB0T](http://pastebin.com/7x9zWB0T)

My `elasticsearch.yml` file has the below configs. Is there something else I'm missing?

```auto
node.name: node-1  
bootstrap.mlockall: true  
network.host: 127.0.0.1  

```

---

<div class="post-metadata">

**Author:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [May 10, 2016, 8:00pm UTC](https://discuss.elastic.co/t/server-and-client-errors-when-connecting-to-elasticsearch/49703/2 "2016-05-10T20:00:59Z")

</div>

It looks like Samza is using an old version (1.5.1) of the Elasticsearch TransportClient: [https://github.com/apache/samza/blob/master/gradle/dependency-versions.gradle#L20](https://github.com/apache/samza/blob/master/gradle/dependency-versions.gradle#L20)

The binary protocol that the TransportClient uses is only backwards compatible within minor versions. So 1.5.1 can only talk to 1.x, not 2.x. That's probably why the client can connect to the cluster, but then throws an exception because the two are not serializing/deserializing each other's communication correctly.

Caveat: I've never used Samza and have no familiarity with the code/project 🙂

---

<div class="post-metadata">

**Author:** ![Tim\_Washington](https://avatars.discourse-cdn.com/v4/letter/t/73ab20/32.png) [@Tim\_Washington](https://discuss.elastic.co/u/Tim_Washington)\
**Post date:** [May 10, 2016, 8:53pm UTC](https://discuss.elastic.co/t/server-and-client-errors-when-connecting-to-elasticsearch/49703/3 "2016-05-10T20:53:28Z")

</div>

That seems to have done the trick. Cheers 🙂 But now I get these `Malformed content` errors, when writing message `"{\"foo\" : 1}"` to :stream " **someindex/ledger**" with key " **somekey**".

ES:

```auto
org.elasticsearch.index.mapper.MapperParsingException: Malformed content, must start with an object

```

Client:

```auto
13:42:54.235 [ThreadJob] ERROR o.a.s.s.e.ElasticsearchSystemProducer - Failed to index document in Elasticsearch: MapperParsingException[Malformed content, must start with an object]

```

I have a feeling Samza's producer is writing out the payload incorrectly. Any ideas where I should be looking?

Thanks

---

<div class="post-metadata">

**Author:** ![Tim\_Washington](https://avatars.discourse-cdn.com/v4/letter/t/73ab20/32.png) [@Tim\_Washington](https://discuss.elastic.co/u/Tim_Washington)\
**Post date:** [May 10, 2016, 10:33pm UTC](https://discuss.elastic.co/t/server-and-client-errors-when-connecting-to-elasticsearch/49703/4 "2016-05-10T22:33:04Z")

</div>

Ok, sorted this one out. The ES producer doesn't seem to require a serde. Looks like you can just pass in a java map.

---

<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:** [July 5, 2017, 10:52pm UTC](https://discuss.elastic.co/t/server-and-client-errors-when-connecting-to-elasticsearch/49703/5 "2017-07-05T22:52:37Z")

</div>


