Skip to content

Conversation

@philvarner
Copy link
Collaborator

Related Issue(s):

Description:

  1. Create indexes at startup instead of checking and creating if non-existent when ingesting
  2. add a schema for the collections index

PR Checklist:

  • Code is formatted and linted (run pre-commit run --all-files)
  • Tests pass (run make test)
  • Documentation has been updated to reflect changes, if applicable, and docs build successfully (run make docs)
  • Changes are added to the changelog

base_url = str(kwargs["request"].base_url)
try:
collections = self.client.search(
index="stac_collections", doc_type="_doc", query={"match_all": {}}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

doc_type is deprecated, and is assumed to be _doc

@overrides
def item_collection(
self, collection_id: str, limit: int = 10, **kwargs
self, collection_id: str, limit: int = 10, token: str = None, **kwargs
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated this signature wrt the ABC

def post_search(
self, search_request: BaseSearchPostRequest, **kwargs
) -> ItemCollection:
def post_search(self, search_request: Search, **kwargs) -> ItemCollection:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated wrt the ABC

session: Session = attr.ib(default=attr.Factory(Session.create_from_env))
client = ElasticsearchSettings().create_client

ES_MAPPINGS_DYNAMIC_TEMPLATES = [
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

copied from transactions.py.

},
}

ES_COLLECTIONS_MAPPINGS = {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added a mapping for collections -- same one used in stac-server

@philvarner philvarner merged commit c4cbd0d into main Mar 16, 2022
@philvarner philvarner deleted the pv/create_indexes_at_startup branch March 16, 2022 19:39
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