Skip to content

Conversation

@missinglink
Copy link
Member

this experimental 'patch' post-processing script can be used to update documents before being indexed in elasticsearch.

patch operations can be defined in pelias.json with the same syntax as the blacklist stream:

{
  "imports": {
    "patch": {
      "files": [
        "path/to/definition.json"
      ]
    }
  }
}

each definition file is in JSON format, currently we only support the set operation, but the struct is extendable to include additional operation types in the future:

{
  "geonames:county:3333219": {
    "set": {
      "name.default": ["Los Angeles County"]
    }
  }
}

the post processing script targets documents using their GID, then for every key in the set object it calls the underscore function _.set() with the key and value.

note that values are not validated and are not run through the Document setters, so some care should be taken to ensure the values are correct.

this is intended for critical one-off patches where the source data cannot be updated and released in a timely manner.

@missinglink missinglink merged commit c631b4e into master Sep 29, 2025
5 checks passed
@missinglink missinglink deleted the patch-post-script branch September 29, 2025 13:56
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.

3 participants