Skip to content

Conversation

@arnesetzer
Copy link

👋 I did some awesome work for the Pelias project and would love for everyone to have a look at it and provide feedback.


Here's the reason for this change 🚀

Closes pelias/docker#371 which allows the docker command pelias elastic stats to use a different index name than the hardcoded ("pelias").


Here's what actually got changed 👏

Moves the logic of the command pelias elastic stats from the docker repo to this repo to be able to use the command with other index names.


Here's how others can test the changes 👀

  1. Change pelias.json like
"schema": {
    "indexName": "everything except pelias"
},
"api": {
    "indexName": "everything except pelias"
}
  1. Import some data
  2. Execute node script/check_stats
    or
  3. docker build -t differentName/pelias-schema -f Dockerfile .
  4. Modify the docker-compose.yml to
 schema:
    image: differentName/pelias-schema
  1. Change pelias.json like
"schema": {
    "indexName": "everything except pelias"
},
"api": {
    "indexName": "everything except pelias"
}
  1. Import some data
  2. Execute pelias elastic stats

Copy link
Member

@missinglink missinglink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With that one minor change it works great:

docker compose run --rm -it schema node scripts/check_stats.js
{
  "took": 157,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 10000,
      "relation": "gte"
    },
    "max_score": null,
    "hits": []
  },
  "aggregations": {
    "sources": {
      "doc_count_error_upper_bound": 0,
      "sum_other_doc_count": 0,
      "buckets": [
        {
          "key": "openaddresses",
          "doc_count": 1389013,
          "layers": {
            "doc_count_error_upper_bound": 0,
...
`

@missinglink
Copy link
Member

Can you please also change the other line in that file:

console.log(`Results for index ${config.schema.indexName}`)

@missinglink
Copy link
Member

missinglink commented Mar 11, 2025

So.. regarding api.indexName vs. schema.indexName it sounds like we have them both for exactly the scenario you described, where multiple indices are generated in the same ES server and there is flexibility to configure them independently. pelias/api#1691 (comment)

As to which of the two we use here.. if we set it to api.indexName then you can't use it to check the stats of new builds before they are promoted to production.

If we set it to schema.indexName then you can't use it to see the active production stats.

Would it make sense to let the script accept an argv argument instead so it could be used for either?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pelias elastic stats has the default index hardcoded

2 participants