Kibana: [console] GET with body acts as POST

Created on 10 Apr 2017  路  13Comments  路  Source: elastic/kibana

Kibana version:
5.3.0
Elasticsearch version:
5.3.0
Server OS version:
Mac
Browser version:
Chrome 57
Browser OS version:

Original install method (e.g. download page, yum, from source, etc.):
download page
Description of the problem including expected versus actual behavior:

Steps to reproduce:

  1. In dev tools try: GET /customer/test {}
  2. Execute
  3. This is what you get:
    {
    "_index": "customer",
    "_type": "test",
    "_id": "AVtYSTXO_fGvlLKTJrMR",
    "_version": 1,
    "result": "created",
    "_shards": {
    "total": 2,
    "successful": 1,
    "failed": 0
    },
    "created": true
    }

GET should never insert a document!

Console Dev Tools Elasticsearch UI blocked bug

Most helpful comment

If you look at the network tab, GET is being modified by a POST internally:

screen shot 2017-08-15 at 12 38 12

This issue is mainly in Kibana devtools that it is modifying the method and not in elasticsearch updating documents with GET operations. That said, until we do not fix this the workarounds are:

  1. Use plain curl (which you can do by clicking on the button next to the arrow and copying as CURL).
  2. Prevent using GET operations with JSON inputs

All 13 comments

@tylersmalley any chance this is something we can tackle before 6.0?

@alexbrasetvik, we will try for it. It's all dependent on when the 6.0 migration changes are finalized.

awesome - thanks @tylersmalley. You tagged the wrong Alex btw. I'm the one with the extremely French Canadian last name 馃槃

this bug just bit me in production, and I can't delete the mappings that were created by another dev :(

this is pretty severe bug IMO and apparently present in much earlier versions

If you look at the network tab, GET is being modified by a POST internally:

screen shot 2017-08-15 at 12 38 12

This issue is mainly in Kibana devtools that it is modifying the method and not in elasticsearch updating documents with GET operations. That said, until we do not fix this the workarounds are:

  1. Use plain curl (which you can do by clicking on the button next to the arrow and copying as CURL).
  2. Prevent using GET operations with JSON inputs

A quick summary what's happening: browsers will strip request bodies on GET requests, so we automatically convert these to POST requests.

I completely agree that this shouldn't be happening, but the fix needs to have a broader discussion because chunks of the elasticsearch docs use GET requests with bodies and have a view in console button, example

Blocked by updating all the docs as @jbudz pointed out above.

@tylersmalley If all the documentation was updated, then why is the issue blocked? I think you mean unblocked, right?
I also got bitten today by this bug.

@amerzad, the documentation has not been updated - so this issue is blocked on the completion of that.

I got bitten today by this bug as well....three of us spent 2 hours trying to find the root cause....

I got bitten today by this bug as well....three of us spent 2 hours trying to find the root cause....

@wangyunlongau , me too. When testing Kibana it's very easy to trigger this bug. Perhaps some error-checking on the front-end could issue a warning.

Pinging @elastic/es-ui

For anyone who's interested, I'm solving this in https://github.com/elastic/kibana/pull/39170 by removing the coercion from GET to POST in the browser and swapping out our http lib on the server with one that allows bodies with GET requests (and DELETE requests).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bradvido picture bradvido  路  3Comments

timmolter picture timmolter  路  3Comments

bhavyarm picture bhavyarm  路  3Comments

treussart picture treussart  路  3Comments

spalger picture spalger  路  3Comments