#!/usr/bin/env bash

inserted=$(curl -s -H "Content-type: application/json" -X POST http://localhost:7280/api/v1/${test}/search/ \
  -d '{"query":"*","max_hits":0,"aggs":{"count(*)":{"value_count":{"field":"id"}}}}' | jq .num_hits)
echo -e "\tCount of inserted documents: $inserted"


# Should be 1732817071
# But because of issue https://github.com/quickwit-oss/quickwit/issues/5465 we check for 1732817062
if [[ ! $inserted -eq 1732817062 ]]; then
  echo "Inserted count mismatch"
  exit 1
fi
