Merge "Fix kibana3 url quoting"

This commit is contained in:
Jenkins 2015-10-16 19:35:35 +00:00 committed by Gerrit Code Review
commit 5d2db1e36f
1 changed files with 6 additions and 3 deletions

View File

@ -19,7 +19,7 @@ by elastic recheck to talk with elastic search.
"""
import json
from six.moves.urllib.parse import urlencode
from six.moves.urllib.parse import quote as urlquote
def generic(raw_query, facet=None):
@ -139,6 +139,9 @@ def encode_logstash_query(query, timeframe=864000):
# things like " are properly escaped. But we dont
# want the outer ""s that result from dumpsing the
# string so we strip those off again. And finally
# the whole thing gets urlencoded.
# the whole thing gets quoted to escape spaces and
# special characters. Note that kibana3 is braindead
# and expects its parameters url quoted not parameter
# encoded
query = json.dumps(query)[1:-1]
return urlencode({'query': query, 'from': timeframe})
return 'query=' + urlquote(query) + "&from=" + timeframe