-
-
Notifications
You must be signed in to change notification settings - Fork 263
Make 'pelias elastic stats' use index from pelias.json instead of static index name #372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,7 +62,14 @@ function elastic_info(){ curl -s "http://${ELASTIC_HOST:-localhost:9200}/"; } | |
| register 'elastic' 'info' 'display elasticsearch version and build info' elastic_info | ||
|
|
||
| function elastic_stats(){ | ||
| curl -s "http://${ELASTIC_HOST:-localhost:9200}/pelias/_search?request_cache=true&timeout=10s&pretty=true" \ | ||
| #Extract the API section from the pelias.json | ||
| api_section=$(cat "$DATA_DIR/../pelias.json" | sed -n '/"api": {/,/}/p') | ||
| #Extract the value of api.indexName | ||
| index_name=$(echo "$api_section" | grep '"indexName"' | sed 's/.*"indexName": "\(.*\)".*/\1/') | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer to avoid using
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This works, but only when the node -e "console.log(require('pelias-config').generate().schema.indexName)"
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it's best to move this into the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, should resolve all the current problems. |
||
| #Add info which index is queried | ||
| echo "Results for index \"${index_name:-"pelias"}\":" | ||
| #Query the index in question or use the default name (pelias) | ||
| curl -s "http://${ELASTIC_HOST:-localhost:9200}/${index_name:-"pelias"}/_search?request_cache=true&timeout=10s&pretty=true" \ | ||
| -H 'Content-Type: application/json' \ | ||
| -d '{ | ||
| "aggs": { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
pelias.jsonfile is not always relative to the$DATA_DIR.