_refresh is throwing error [post /indexname/_refresh] does not support having a body

I deployed a elasticsearch on Azure using Elasticsearch (Self-Managed)

I am using NEST nuget package to communicate to elasticsearch api in a .net application.

This my application works fine with elastic search hosted on aws. In case of Azure deployment I am getting below exception from elastic search when trying to refresh index.

The nuget package is creating below request

response = await client.Indices.RefreshAsync(indexName).ConfigureAwait(false);

The above call creates below request. I captured it using WireShark

POST /azureelasticindex_uact7de0dd994d174895bbdd8cff0a3a0123/_refresh HTTP/1.1
Accept: application/json
Content-Type: application/json
User-Agent: elasticsearch-net/7.4.1 (Microsoft Windows 10.0.19043; .NET Framework 4.8.4341.0; Nest)
Authorization: Basic ********
Host: lb-***********.cloudapp.azure.com:9200
Content-Length: 2

In response of above request I am getting

HTTP/1.1 400 Bad Request
content-type: application/json; charset=UTF-8
content-length: 357
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"request [POST /myindexname/_refresh] does not support having a body"}],"type":"illegal_argument_exception","reason":"request [POST /myindexname/_refresh] does not support having a body"},"status":400}

also if create same request using kibana-console I am getting same error on Azure but on AWS everything works fine



What is the problem here?


In the screenshot you shared for Azure, you are calling GET instead of POST. Is that expected?

Thanks for pointing out for wrong capture. By mistake I clipped wrong image and put in the post. I have corrected the image.

I suspect that there's a proxy or something like that in the middle? It looks weird indeed.

What is the output of


On both clusters?

I would also guess that a proxy along the way may be removing this empty content. I noticed from the output that you are using NEST 7.4.1. The latest versions no longer send empty objects in the request body. The clients are backwards compatible with the previous 7.x versions of Elasticsearch, so I'd recommend updating to 7.13.2 which should resolve the issue here.

1 Like

thanks for you replies. The issue was version of elastic search. On AWS installed version is 7.9.1. In this version _refresh api supports body.

On Azure I installed 7.11.1 and in this version body in _refresh api is not supported. To use 7.11.1, nuget packages must be updated. Latest nuget package is not sending empty body in _refresh api.

Currently to work with our code I installed elasticsearch 7.9.3. and this version also supports body in _refresh api.

Thanks again for your support.

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