Skip to content

Commit

Permalink
Fix es url formation when params exist in json data (#2133)
Browse files Browse the repository at this point in the history
  • Loading branch information
npalaska authored Mar 8, 2021
1 parent 8caf11d commit bded8bc
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ def post(self):

try:
# query Elasticsearch
url = f"{self.elasticsearch}/{json_data['indices']}"
if "params" in json_data:
url = (
f"{self.elasticsearch}/{json_data['indices']}?{json_data['params']}"
)
else:
url = f"{self.elasticsearch}/{json_data['indices']}"
if "ignore_unavailable" in json_data["params"]:
url = f"{url}?ignore_unavailable={json_data['params']['ignore_unavailable']}"

if "payload" in json_data:
es_response = requests.post(url, json=json_data["payload"])
Expand Down

0 comments on commit bded8bc

Please sign in to comment.