Skip to content

Commit

Permalink
indexer: Allow the definition of indices in index_templates, instead …
Browse files Browse the repository at this point in the history
…of mappings
  • Loading branch information
psaiz authored and slint committed Mar 4, 2024
1 parent ac7ae4f commit b97723a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion invenio_indexer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ def default_record_to_index(record):
:param record: The record object.
:returns: index.
"""
index_names = current_search.mappings.keys()
# The indices could be defined either in the mappings or in the index_templates
index_names = list(current_search.mappings.keys()) + list(
current_search.index_templates.keys()
)
schema = record.get("$schema", "")
if isinstance(schema, dict):
schema = schema.get("$ref", "")
Expand Down
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ tests =
elasticsearch7 =
# needed: 7.5.0 integrates https://github.com/elastic/elasticsearch-py/pull/1062
elasticsearch>=7.5.0,<7.14.0
invenio-search[elasticsearch7]>=2.1.0,<3.0.0
invenio-search[elasticsearch7]>=2.3.0,<3.0.0
opensearch1 =
invenio-search[opensearch1]>=2.1.0,<3.0.0
invenio-search[opensearch1]>=2.3.0,<3.0.0
opensearch2 =
invenio-search[opensearch2]>=2.1.0,<3.0.0
invenio-search[opensearch2]>=2.3.0,<3.0.0
# Kept for backwards compatibility
docs =

Expand Down

0 comments on commit b97723a

Please sign in to comment.