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.
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.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.