How can I force Elasticsearch to return 429?

I would like to try how my client application reacts to backpressure, so I would like the server to always respond with 429. Is this possible somehow? Thanks!

OK, for future documentation, here is how I did it: I used Charles Proxy (I'm not affiliated in any way) to alter the server replies. You can set up Charles in Reverse proxy mode, simulating to be the ES node, forwarding requests to the real ES node but altering the traffic in the way if necessary.

I configured Charles in port 9201 and I configured 2 rules:

  • Calls to /_nodes endpoint with response bodies containing the number 9200 were altered to 9201 (so that clients using the _nodes endpoint to discover all nodes will keep talking to Charles, not ES)
  • Calls to the /_bulk endpoint return 429 status code
1 Like

Neat idea, thanks for sharing it.

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