ES keeps returning every document

In your HEAD plugin, you need to use POST in order to send the query in the payload, otherwise the _search endpoint is hit without any constraints.

In your browser, if you open the developer tools and look at the networking tab, you’ll see that nothing is sent in the payload when using GET.

It’s a common mistake people often do. Some HTTP clients (like curl) do send a payload using GET, but others (like /head/) don’t. Sense will warn you if you use GET instead of POST when sending a payload and will automatically force POST instead of GET.

So to sum it up, it’s best to always use POST whenever you wish to send some payload to your servers, so you don’t have to care about the behavior of the HTTP client you’re using.

Leave a Comment