Skip to content

Commit bded8bc

Browse files
authored
Fix es url formation when params exist in json data (#2133)
1 parent 8caf11d commit bded8bc

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/pbench/server/api/resources/query_apis/elasticsearch_api.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,10 @@ def post(self):
2525

2626
try:
2727
# query Elasticsearch
28+
url = f"{self.elasticsearch}/{json_data['indices']}"
2829
if "params" in json_data:
29-
url = (
30-
f"{self.elasticsearch}/{json_data['indices']}?{json_data['params']}"
31-
)
32-
else:
33-
url = f"{self.elasticsearch}/{json_data['indices']}"
30+
if "ignore_unavailable" in json_data["params"]:
31+
url = f"{url}?ignore_unavailable={json_data['params']['ignore_unavailable']}"
3432

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

0 commit comments

Comments
 (0)