# The document was updated while using GET request with JSON content

**URL:** <https://discuss.elastic.co/t/the-document-was-updated-while-using-get-request-with-json-content/99239>\
**Category:** Elasticsearch\
**Created:** [September 4, 2017, 3:53am UTC](https://discuss.elastic.co/t/the-document-was-updated-while-using-get-request-with-json-content/99239 "2017-09-04T03:53:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![byakuinss](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/byakuinss/32/23954_2.png) [@byakuinss](https://discuss.elastic.co/u/byakuinss)\
**Post date:** [September 4, 2017, 3:53am UTC](https://discuss.elastic.co/t/the-document-was-updated-while-using-get-request-with-json-content/99239/1 "2017-09-04T03:53:42Z")

</div>

Hi all,

I was practicing the simple DSL in Kibana dev tools page. (Elasticsearch version: 5.4.1)  
There is only one document in the new index.

Create document

```auto
PUT /megacorp/employee/1
{
    "first_name" : "John",
    "last_name" : "Smith",
    "age" : 25,
    "about" : "I love to go rock climbing",
    "interests": ["sports", "music"]
}

```

Then, I changed `PUT` to `GET`, also changed `age` to 30.

```auto
GET /megacorp/employee/1
{
    "first_name" : "John",
    "last_name" : "Smith",
    "age" : 30,
    "about" : "I love to go rock climbing",
    "interests": ["sports", "music"]
}

```

I just want to test whether I use the GET request with JSON content or not, then elasticsearch returns these messages:

```auto
{
  "_index": "megacorp",
  "_type": "employee",
  "_id": "1",
  "_version": 6,
  "result": "updated",
  "_shards": {
    "total": 1,
    "successful": 1,
    "failed": 0
  },
  "created": false
}

```

Looks like the document has been updated. The `age` field is 30 now.

```auto
{
  "_index": "megacorp",
  "_type": "employee",
  "_id": "1",
  "_version": 7,
  "found": true,
  "_source": {
    "first_name": "John",
    "last_name": "Smith",
    "age": 30,
    "about": "I love to go rock climbing",
    "interests": [
      "sports",
      "music"
    ]
  }
}

```

I know I can just use the simple one line to query documents (`GET /megacorp/employee/1`),  
but I'm a little curiosity about why can GET request do the update operation.  
Does it work as designed?

---

<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:** [September 4, 2017, 5:18am UTC](https://discuss.elastic.co/t/the-document-was-updated-while-using-get-request-with-json-content/99239/2 "2017-09-04T05:18:06Z")

</div>

Your GET with body is actually sent as a POST. That's why it's updated.

If you use curl instead you will see that the body is ignored.

---

<div class="post-metadata">

**Author:** ![byakuinss](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/byakuinss/32/23954_2.png) [@byakuinss](https://discuss.elastic.co/u/byakuinss)\
**Post date:** [September 4, 2017, 6:04am UTC](https://discuss.elastic.co/t/the-document-was-updated-while-using-get-request-with-json-content/99239/3 "2017-09-04T06:04:42Z")

</div>

Thank you for your helpful explanation!

---

<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:** [October 2, 2017, 6:04am UTC](https://discuss.elastic.co/t/the-document-was-updated-while-using-get-request-with-json-content/99239/4 "2017-10-02T06:04:45Z")

</div>

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