Skip to content

Remove the calculated field index_version #755

@yuanzhou

Description

@yuanzhou

Currently we are adding this index_version as part of the calculated information for EACH entity document. This is totally unnecessary since this field is just the VERSION number and it doesn't reflect the actual deployment (the BUILD number) nor the actual data source (from entity-api).

def add_calculated_fields(self, entity):
logger.info("Start executing add_calculated_fields()")
# Add index_version by parsing the VERSION file
entity['index_version'] = self.index_version

The portal-ui uses both this index_version and their portal translation generated mapper_version (which is more accurate). So supposedly they can just stop referencing this index_version in the portal-ui and we can remove it.

def _get_version():
# Use the generated BUILD (under project root directory) version (git branch name:short commit hash)
# as Elasticsearch mapper_metadata.version
build_path = Path(__file__).absolute(
).parent.parent.parent.parent.parent / 'BUILD'
if build_path.is_file():
# Use strip() to remove leading and trailing spaces, newlines, and tabs
version = build_path.read_text().strip()
logging.debug(f'Read "{version}" from {build_path}')
return version
logging.debug(f'Using place-holder version; No such file: {build_path}')
return 'no-build-file'

Metadata

Metadata

Assignees

No one assigned

    Labels

    PPitt dev team

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions