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

Running query with embedded "%" sign causes "internal server error" #11273

Closed
ccurvey opened this issue Apr 17, 2017 · 6 comments
Closed

Running query with embedded "%" sign causes "internal server error" #11273

ccurvey opened this issue Apr 17, 2017 · 6 comments
Labels
Feature:Console Dev Tools Console Feature Feature:Dev Tools

Comments

@ccurvey
Copy link

ccurvey commented Apr 17, 2017

Kibana version:

5.x

Elasticsearch version:

5.3.0

Server OS version:

??

Browser version:

Firefox 50

Browser OS version:

Fedora 23 (Qubes version)

Original install method (e.g. download page, yum, from source, etc.):

None. Using Elastic Cloud/X-Pack

Description of the problem including expected versus actual behavior:

Running query with embedded "%" sign causes "internal server error"

Steps to reproduce:

  1. Run this query:
q = '''
{
    "size" : 20,
    "query" : {
        "bool" : {
            "must" : {
                "multi_match" : {
                    "fields" : ["text", "title"],
                    "query" : "Donald Trump",
                    "fuzziness": "1",
                    "prefix_length": "4",
                    "max_expansions" : "5",
                    "minimum_should_match": "3<90%"
                }
            }
   
  }
}
  1. You will get an internal server error
  2. Run the same query, removing the "minimum_should_match" clause. You'll get results.

For further background, see https://discuss.elastic.co/t/query-works-through-python-interface-fails-in-kibana/82423

@stacey-gammon stacey-gammon changed the title " Running query with embedded "%" sign causes "internal server error" Apr 17, 2017
@lukasolson
Copy link
Member

Are you running this query in Console, or Discover? I'm not getting the same error in either place.

@ccurvey
Copy link
Author

ccurvey commented Apr 17, 2017

I'm running it in what used to be called "Sense"...I'm not sure what it is called now in X-Pack-Land :)

Incidentally, the query works fine if submitted via a Python program or CURL, so it's something to do with the [whatever we are calling Sense now] interface.

@jbudz
Copy link
Member

jbudz commented Apr 18, 2017

@AlexP-Elastic are you expecting POST bodies with content-type application/json to be url encoded?

@jbudz jbudz added Feature:Console Dev Tools Console Feature Feature:Dev Tools labels Apr 18, 2017
@AlexP-Elastic
Copy link

AlexP-Elastic commented Apr 19, 2017

I just tried to reproduce this in 5.3.1 on EC using Console and unlike in the issue @ccurvey ran into, the query gets posted in the body via <host etc>/api/console/proxy?uri=_search

Whereas @ccurvey reported the following endpoint: <host etc>/api/console/proxy?uri=<encoded _search URI>&<JSON-body-incorrectly-URL-encoded>

@jbudz or @lukasolson is there any way that Kibana can "decide" (eg based on OS or browser or something else?) to try to put the body encoded in the URL as per this copy/paste from the dev console: https://discuss.elastic.co/t/query-works-through-python-interface-fails-in-kibana/82423/12? (it's definitely not something Elastic Cloud is doing?)

@AlexP-Elastic
Copy link

AlexP-Elastic commented Apr 19, 2017

Ah OK I've investigated further and can now "reproduce": GET _search works (ie includes a separate body) but if I then replace GET with get (lower case) then the failure occurs .. an unobtrusive error is shown next to the get but the "play" button doesn't go away (unlike if you just paste the whole request in directly, when the "play" button disappears)

So the issue (if there is one) seems to be error handling? (ie the "play" button should go away)

(The lower case version of the verb is used incidentally, despite the error, eg post works identically to POST ditto put and PUT, it's just get that behaves differently)

For completeness here's the full thing I pasted into console to get it to fail:

GET _search
{
    "size" : 20,
    "query" : {
        "bool" : {
            "must" : {
                "multi_match" : {
                    "fields" : ["text", "title"],
                    "query" : "Donald Trump",
                    "fuzziness": "1",
                    "prefix_length": "4",
                    "max_expansions" : "5",
                    "minimum_should_match": "3<90%"
                }
            }
      }
  }
}

then replace GET with get

@jbudz
Copy link
Member

jbudz commented Oct 5, 2017

Great, tracking at #8832. We have #14327 opened to address this.

@jbudz jbudz closed this as completed Oct 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Console Dev Tools Console Feature Feature:Dev Tools
Projects
None yet
Development

No branches or pull requests

4 participants