Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[console] GET with body acts as POST #11125

Closed
arunqkumar opened this issue Apr 10, 2017 · 13 comments · Fixed by #46200
Closed

[console] GET with body acts as POST #11125

arunqkumar opened this issue Apr 10, 2017 · 13 comments · Fixed by #46200
Assignees
Labels
blocked bug Fixes for quality problems that affect the customer experience Feature:Console Dev Tools Console Feature Feature:Dev Tools Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more

Comments

@arunqkumar
Copy link

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!

@alexfrancoeur
Copy link

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

@tylersmalley
Copy link
Contributor

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

@alexfrancoeur
Copy link

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

@JohnnyMarnell
Copy link

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

@gmoskovicz
Copy link
Contributor

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

@jbudz
Copy link
Member

jbudz commented Oct 5, 2017

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

@jbudz jbudz changed the title GET header acts as POST if _search is not provided GET with body acts as POST Oct 5, 2017
@jbudz jbudz changed the title GET with body acts as POST [console] GET with body acts as POST Oct 5, 2017
@tylersmalley
Copy link
Contributor

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

@amerzad
Copy link

amerzad commented May 6, 2018

@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.

@tylersmalley
Copy link
Contributor

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

@wangyunlongau
Copy link

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

@samd2
Copy link

samd2 commented Jan 22, 2019

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.

@cjcenizal cjcenizal added Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more and removed :Management DO NOT USE labels Jun 14, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/es-ui

@cjcenizal cjcenizal self-assigned this Jun 17, 2019
@cjcenizal
Copy link
Contributor

cjcenizal commented Jun 20, 2019

For anyone who's interested, I'm solving this in #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).

predogma added a commit that referenced this issue Aug 11, 2021
Per a slack discussion https://elastic.slack.com/archives/C0D1XEXEZ/p1628706191394900

There is a misleading issue with Kibana > Dev Tools, regarding posting a GET request with a body, in particular say a search.  

GET [index]/_search {....} this gets converted to a POST request.  It can be seen if you are looking at the console view in the browser tools.

This can cause different responses (different results) when using Kibana versus other tools ex. POSTMAN when diagnosing something such as a search query with aggs.

See references: 
#11593
#11125
#11948

This doc change is to add it so that is it more obvious that we do this (transform to POST when GET has body).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked bug Fixes for quality problems that affect the customer experience Feature:Console Dev Tools Console Feature Feature:Dev Tools Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more
Projects
None yet