ci: Always use _search API instead of _count
Makes it easier to troubleshoot returned documents by inspecting the logs of CI runs.
This commit is contained in:
parent
e9903fecf6
commit
b826d7bbdf
|
@ -36,6 +36,7 @@ curl -X POST -D- "http://${ip_kb}:5601/api/saved_objects/index-pattern" \
|
||||||
log 'Searching index pattern via Kibana API'
|
log 'Searching index pattern via Kibana API'
|
||||||
response="$(curl "http://${ip_kb}:5601/api/saved_objects/_find?type=index-pattern" -s -u elastic:testpasswd)"
|
response="$(curl "http://${ip_kb}:5601/api/saved_objects/_find?type=index-pattern" -s -u elastic:testpasswd)"
|
||||||
echo "$response"
|
echo "$response"
|
||||||
|
declare -i count
|
||||||
count="$(jq -rn --argjson data "${response}" '$data.total')"
|
count="$(jq -rn --argjson data "${response}" '$data.total')"
|
||||||
if (( count != 1 )); then
|
if (( count != 1 )); then
|
||||||
echo "Expected 1 index pattern, got ${count}"
|
echo "Expected 1 index pattern, got ${count}"
|
||||||
|
@ -66,9 +67,9 @@ curl -X POST "http://${ip_es}:9200/_refresh" -u elastic:testpasswd \
|
||||||
-s -w '\n'
|
-s -w '\n'
|
||||||
|
|
||||||
log 'Searching message in Elasticsearch'
|
log 'Searching message in Elasticsearch'
|
||||||
response="$(curl "http://${ip_es}:9200/logstash-*/_count?q=message:dockerelk&pretty" -s -u elastic:testpasswd)"
|
response="$(curl "http://${ip_es}:9200/logstash-*/_search?q=message:dockerelk&pretty" -s -u elastic:testpasswd)"
|
||||||
echo "$response"
|
echo "$response"
|
||||||
count="$(jq -rn --argjson data "${response}" '$data.count')"
|
count="$(jq -rn --argjson data "${response}" '$data.hits.total.value')"
|
||||||
if (( count != 1 )); then
|
if (( count != 1 )); then
|
||||||
echo "Expected 1 document, got ${count}"
|
echo "Expected 1 document, got ${count}"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
@ -20,10 +20,10 @@ log 'Waiting for readiness of Enterprise Search'
|
||||||
poll_ready "$cid_en" "http://${ip_en}:3002/api/ent/v1/internal/health" -u 'elastic:testpasswd'
|
poll_ready "$cid_en" "http://${ip_en}:3002/api/ent/v1/internal/health" -u 'elastic:testpasswd'
|
||||||
|
|
||||||
log 'Ensuring that App Search API keys were created in Elasticsearch'
|
log 'Ensuring that App Search API keys were created in Elasticsearch'
|
||||||
response="$(curl "http://${ip_es}:9200/.ent-search-actastic-app_search_api_tokens_v3/_count?pretty" -s -u elastic:testpasswd)"
|
response="$(curl "http://${ip_es}:9200/.ent-search-actastic-app_search_api_tokens_v3/_search?q=*:*&pretty" -s -u elastic:testpasswd)"
|
||||||
echo "$response"
|
echo "$response"
|
||||||
declare -i count
|
declare -i count
|
||||||
count="$(jq -rn --argjson data "${response}" '$data.count')"
|
count="$(jq -rn --argjson data "${response}" '$data.hits.total.value')"
|
||||||
if (( count != 2)); then
|
if (( count != 2)); then
|
||||||
echo "Expected search and private keys, got ${count} result(s)"
|
echo "Expected search and private keys, got ${count} result(s)"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
Loading…
Reference in New Issue