elastic / sense

A JSON aware developer's interface to Elasticsearch. Comes with handy machinery such as syntax highlighting, autocomplete, formatting and code folding.
Other
382 stars 132 forks source link

GET request ends up indexing a document #86

Open javanna opened 8 years ago

javanna commented 8 years ago

If you have a search api call but you omit the _search endpoint in the url, you end up indexing a document:

GET test/my_type
{
  "query" : {
    "match_all": {}
  }
}

Same doesn't happen via command line, where you get a "feature not found" as the request goes to the get index api and the type is not recognized as a feature. Good as it throws an error rather than writing. We should never write with GET!

spalger commented 8 years ago

Unfortunately we can't make GET requests with bodies, so the only way to fix this is to prevent users from writing them in sense

spalger commented 8 years ago

I agree with you though, that example should not create a document in es

bleskes commented 8 years ago

yeah, this has been raised before and is indeed a pain. The idea I had for solving this is only do the GET-> POST auto converstion for white listed APIs where we know it's safe. Typically _search.

robin13 commented 8 years ago

Same problem if you want to do an _explain for a query:

GET /index/type/_explain
{
   "query": {
...

This creates a document _explain which is really not what I wanted to do... So as-is, there is no way to _explain with sense. :(

pmusa commented 8 years ago

Any feedback on this?