Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to select between GET and POST method for queries, in order to support also Elasticsearch servers behind Load Balancers #194

Open
carminexx opened this issue Jul 18, 2023 · 0 comments

Comments

@carminexx
Copy link

Background and remarks

Due to debatable design decisions made in Elasticsearch, the GET with body remained the standard to perform queries, and this is also the default behavior of the Logstash Elasticsearch Input plugin.

The issue is that GET requests with a body are non-standard (or at least "strongly discouraged" in several implementations).

This, for example, makes this Logstash plugin unusable when the Elasticsearch input server is behind a Google Load Balancer, that, by design, strips the request body in a GET request.
The same applies to Elasticsearch servers behind a WAF; behind a reverse proxy with strict enforcements on HTTP request format; and so on.

References

Feature proposal

Add the ability to select the actual HTTP method used to perform the requests for queries, allowing the user to choose between the GET (that is, unfortunately, the standard) and the POST (also supported by Elasticsearch) verbs.

A simple idea may be to just add a field when creating the Logstash pipeline, like:

# [source,ruby]
#     input {
#       # Read all documents from Elasticsearch matching the given query
#       elasticsearch {
#         hosts => "localhost"
#         query => '{ "query": { "match": { "statuscode": 200 } }, "sort": [ "_doc" ] }'
#         query_method => 'POST'
#       }
#     }
#
# This would create an Elasticsearch query with the following format:
# [source,json]
#     curl --request POST 'http://localhost:9200/logstash-*/_search?&scroll=1m&size=1000' -d '{
#       "query": {
#         "match": {
#           "statuscode": 200
#         }
#       },
#       "sort": [ "_doc" ]
#     }'```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant