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

**URL:** <https://discuss.elastic.co/t/refresh-is-throwing-error-post-indexname-refresh-does-not-support-having-a-body/279940>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [July 29, 2021, 7:22am UTC](https://discuss.elastic.co/t/refresh-is-throwing-error-post-indexname-refresh-does-not-support-having-a-body/279940 "2021-07-29T07:22:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sumit\_Gaud](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sumit_gaud/32/92295_2.png) [@Sumit\_Gaud](https://discuss.elastic.co/u/Sumit_Gaud)\
**Post date:** [July 29, 2021, 7:22am UTC](https://discuss.elastic.co/t/refresh-is-throwing-error-post-indexname-refresh-does-not-support-having-a-body/279940/1 "2021-07-29T07:22:46Z")

</div>

Hi,  
I deployed a elasticsearch on Azure using [Elasticsearch (Self-Managed)](https://azuremarketplace.microsoft.com/en-in/marketplace/apps/elastic.elasticsearch?tab=Overview)

I am using [NEST](https://www.nuget.org/packages/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

```auto
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

```auto
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

**Azure**

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/c/6/c644e389988f5f77cb76973a3375021ff10028e9.png)

**AWS**  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1a481231d92858df5f890e2dee04f2d94568805c.png)

What is the problem here?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 29, 2021, 8:18am UTC](https://discuss.elastic.co/t/refresh-is-throwing-error-post-indexname-refresh-does-not-support-having-a-body/279940/2 "2021-07-29T08:18:00Z")

</div>

Welcome!

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

---

<div class="post-metadata">

**Author:** ![Sumit\_Gaud](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sumit_gaud/32/92295_2.png) [@Sumit\_Gaud](https://discuss.elastic.co/u/Sumit_Gaud)\
**Post date:** [July 29, 2021, 10:38am UTC](https://discuss.elastic.co/t/refresh-is-throwing-error-post-indexname-refresh-does-not-support-having-a-body/279940/3 "2021-07-29T10:38:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 29, 2021, 10:55am UTC](https://discuss.elastic.co/t/refresh-is-throwing-error-post-indexname-refresh-does-not-support-having-a-body/279940/4 "2021-07-29T10:55:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 29, 2021, 10:56am UTC](https://discuss.elastic.co/t/refresh-is-throwing-error-post-indexname-refresh-does-not-support-having-a-body/279940/5 "2021-07-29T10:56:44Z")

</div>

What is the output of

```
GET /

```

On both clusters?

---

<div class="post-metadata">

**Author:** ![stevejgordon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stevejgordon/32/80912_2.png) [@stevejgordon](https://discuss.elastic.co/u/stevejgordon)\
**Post date:** [July 29, 2021, 11:10am UTC](https://discuss.elastic.co/t/refresh-is-throwing-error-post-indexname-refresh-does-not-support-having-a-body/279940/6 "2021-07-29T11:10:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Sumit\_Gaud](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sumit_gaud/32/92295_2.png) [@Sumit\_Gaud](https://discuss.elastic.co/u/Sumit_Gaud)\
**Post date:** [July 29, 2021, 12:50pm UTC](https://discuss.elastic.co/t/refresh-is-throwing-error-post-indexname-refresh-does-not-support-having-a-body/279940/7 "2021-07-29T12:50:05Z")

</div>

hi,  
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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 26, 2021, 12:51pm UTC](https://discuss.elastic.co/t/refresh-is-throwing-error-post-indexname-refresh-does-not-support-having-a-body/279940/8 "2021-08-26T12:51:00Z")

</div>

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