# Issue with logstash input elasticsearch plugin with ES 5.4

**URL:** <https://discuss.elastic.co/t/issue-with-logstash-input-elasticsearch-plugin-with-es-5-4/85110>\
**Category:** Elasticsearch\
**Created:** [May 9, 2017, 2:15pm UTC](https://discuss.elastic.co/t/issue-with-logstash-input-elasticsearch-plugin-with-es-5-4/85110 "2017-05-09T14:15:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![henrilabarre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/henrilabarre/32/16909_2.png) [@henrilabarre](https://discuss.elastic.co/u/henrilabarre)\
**Post date:** [May 9, 2017, 2:15pm UTC](https://discuss.elastic.co/t/issue-with-logstash-input-elasticsearch-plugin-with-es-5-4/85110/1 "2017-05-09T14:15:08Z")

</div>

HI this conf works with ES 5.3

```
input {
  elasticsearch {
    hosts => "http://localhost:9200"
	index => "sirene"
	query => '{"query": {"query_string" : {"query": "(CODGEO:60471 AND provider:sp_mairie)"}}}'
  }
}
output {
  stdout { codec => json }
}

```

But fail with ES 5.4 with this error:

`Error: [400] {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Failed to parse request body"}],"type":"illegal_argument_exception","reason":"Failed to parse request body","caused_by":{"type":"json_parse_exception","reason":"Unrecognized token 'DnF1ZXJ5VGhlbkZldGNoBQAAAAAAABHMFm84Mm84SFpzU3VHSzdWMHdWQ3N3NGcAAAAAAAARzhZvODJvOEhac1N1R0s3VjB3VkNzdzRnAAAAAAAAEc8WbzgybzhIWnNTdUdLN1Ywd1ZDc3c0ZwAAAAAAABHQFm84Mm84SFpzU3VHSzdWMHdWQ3N3NGcAAAAAAAARzRZvODJvOEhac1N1R0s3VjB3VkNzdzRn': was expecting ('true', 'false' or 'null')\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@d38650b; line: 1, column: 457]"}},"status":400}`

Thanks for your help

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [May 9, 2017, 3:30pm UTC](https://discuss.elastic.co/t/issue-with-logstash-input-elasticsearch-plugin-with-es-5-4/85110/2 "2017-05-09T15:30:18Z")

</div>

I would change your query to be regular syntax and not use `query_string` syntax. It's not listed as a breaking change for 5.4, but I think that they're getting away from using Lucene query\_string as it has a profound ability to do bad things to clusters.

If you were to run the same query against 5.4 from the command-line (via curl, for instance) you would get the same result (a 400 error), I think. As such, this may be more a question for the Elasticsearch forum than the Logstash one.

---

<div class="post-metadata">

**Author:** ![henrilabarre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/henrilabarre/32/16909_2.png) [@henrilabarre](https://discuss.elastic.co/u/henrilabarre)\
**Post date:** [May 9, 2017, 3:32pm UTC](https://discuss.elastic.co/t/issue-with-logstash-input-elasticsearch-plugin-with-es-5-4/85110/3 "2017-05-09T15:32:49Z")

</div>

Hi!

With curl it's working (so I guess it's a logstash question)...  
I will try to change the query in order not to use the query\_string (this is still in the 5.4 docs [https://www.elastic.co/guide/en/elasticsearch/reference/5.4/query-dsl-query-string-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/query-dsl-query-string-query.html)) . What format do you recommend?

Best

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [May 9, 2017, 4:05pm UTC](https://discuss.elastic.co/t/issue-with-logstash-input-elasticsearch-plugin-with-es-5-4/85110/4 "2017-05-09T16:05:52Z")

</div>

Hmm. But it is Elasticsearch that is responding with the 400 error...

Regardless, I would use filters, first and foremost, as you are looking for _exact_ term values. Performing a query instead of a filter here is less efficient. An example is [here](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/query-filter-context.html).

---

<div class="post-metadata">

**Author:** ![henrilabarre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/henrilabarre/32/16909_2.png) [@henrilabarre](https://discuss.elastic.co/u/henrilabarre)\
**Post date:** [May 9, 2017, 4:26pm UTC](https://discuss.elastic.co/t/issue-with-logstash-input-elasticsearch-plugin-with-es-5-4/85110/5 "2017-05-09T16:26:07Z")

</div>

> [@theuntergeek](#):
>
> Regardless, I would use filters, first and foremost, as you are looking for exact term values. Performing a query instead of a filter here is less efficient.

Thanks I will try this way! And move this post to the elastisearch forum

---

<div class="post-metadata">

**Author:** ![henrilabarre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/henrilabarre/32/16909_2.png) [@henrilabarre](https://discuss.elastic.co/u/henrilabarre)\
**Post date:** [May 11, 2017, 7:45am UTC](https://discuss.elastic.co/t/issue-with-logstash-input-elasticsearch-plugin-with-es-5-4/85110/6 "2017-05-11T07:45:34Z")

</div>

resolved here [https://github.com/logstash-plugins/logstash-input-elasticsearch/issues/66](https://github.com/logstash-plugins/logstash-input-elasticsearch/issues/66)

---

<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:** [June 8, 2017, 7:52am UTC](https://discuss.elastic.co/t/issue-with-logstash-input-elasticsearch-plugin-with-es-5-4/85110/7 "2017-06-08T07:52:43Z")

</div>

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