It can sometimes be quiet hard to figure out why a specific ElasticSearch query fails or don’t returns the expected results. As I’m using NEST, the high-level ElasticSearch client, it is not always obvious what is exactly happening behind the scenes.
Here is a code snippet that allows you to log the generated request and response messages:
Remark: Using this code has a performance impact, so only use it for development or testing purposes.