# Queries AWS for data on each test contained in a test suite run id
#
# Example usage:
#   ./query_marvel.sh "6a5bf23c-8fe4-11ea-8d19-004e01c25d99"
#
#
#| jq -r .hits.hits[]._id

suite_run_id=$1

#0: "bazel_target"
#1: "branch"
#2: "combined_chum_uri"
#3: "description"
#4: "duration"
#5: "git_revision"
#BIG 6: "obsbag"
#7: "obsbag_chum_uri"
#8: "passed"
#9: "pipedream_id"
#10: "result"
#11: "run_uuid"
#12: "scenario_params"
#13: "script_path"
#14: "ss_chum_uri"
#15: "start_time"
#16: "test_result_aggregate"
#17: "test_results"
#18: "test_results_ignored"
#19: "log_entries"
#20: "time"
#21: "video"
#22: "video_src"

curl -XPOST -H Content-Type:application/json https://search-sim-metrics-v6-rhfhvb54pmawksutaybix43i6q.us-west-1.es.amazonaws.com/metric_runs/metric_run/_search?pretty=true -d'{
  "_source": {
    "include": ["bazel_target", "branch", "combined_chum_uri", "description",
                "duration", "git_revision", "obsbag_chum_uri", "passed",
                "pipedream_id", "result", "run_uuid", "scenario_params",
                "script_path", "ss_chum_uri", "start_time",
                "test_result_aggregate", "test_results", "test_results_ignored",
                "log_entries", "time", "video", "video_src"]
  },
  "query": {
    "match": {
      "run_uuid": "'$suite_run_id'"
    }
  },
  "size": 1000
}'

