Created
February 3, 2020 20:08
-
-
Save FrankHassanabad/e875ffe325ae0d33e760fc71e3c55c12 to your computer and use it in GitHub Desktop.
Test saved objects and duplicate issues part 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # | |
| # Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | |
| # or more contributor license agreements. Licensed under the Elastic License; | |
| # you may not use this file except in compliance with the Elastic License. | |
| # | |
| set -e | |
| ./check_env_variables.sh | |
| # Uses a default of alert if no argument is specified | |
| TYPE=${1:-alert} | |
| # Example: ./find_saved_object.sh alert | |
| # Example: ./find_saved_object.sh action | |
| # Example: ./find_saved_object.sh action_task_params | |
| # https://www.elastic.co/guide/en/kibana/master/saved-objects-api-find.html#saved-objects-api-find-request | |
| rm -f /tmp/output_per_ten.txt | |
| rm -f /tmp/output_per_one.txt | |
| for i in {1..12} | |
| do | |
| curl -s -k \ | |
| -u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ | |
| -X GET "${KIBANA_URL}${SPACE_URL}/api/saved_objects/_find?per_page=10&type=alert&sort_field=createdAt&page=${i}" | jq . | jq ".saved_objects" | jq ".[].id" >> /tmp/output_per_ten.txt | |
| done | |
| for i in {1..112} | |
| do | |
| curl -s -k \ | |
| -u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ | |
| -X GET "${KIBANA_URL}${SPACE_URL}/api/saved_objects/_find?per_page=1&type=alert&sort_field=createdAt&page=${i}" | jq . | jq ".saved_objects" | jq ".[].id" >> /tmp/output_per_one.txt | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment