Skip to content

ElasticSearch refresh parameter unused? #315

Open
@ccancellieri

Description

Describe the bug
The pagination does not work properly after massive items upload over ElasticSearch as the number of items should still be calculated by ES (probably).
After a while the number is correct and the pagination starts to work.

I noticed that in the driver we have the support for the refresh parameter correctly exposed but it is never used by the stac-api as it is an abstraction layer while 'refresh' is something specific for ElasticSearch:

F.e.:

    async def delete_item(
        self, item_id: str, collection_id: str, refresh: bool = False
    ):
        """Delete a single item from the database.

        Args:
            item_id (str): The id of the Item to be deleted.
            collection_id (str): The id of the Collection that the Item belongs to.
            refresh (bool, optional): Whether to refresh the index after the deletion. Default is False.

        Raises:
            NotFoundError: If the Item does not exist in the database.
        """
        try:
            await self.client.delete(
                index=index_by_collection_id(collection_id),
                id=mk_item_id(item_id, collection_id),
                refresh=refresh,
            )
        except exceptions.NotFoundError:
            raise NotFoundError(
                f"Item {item_id} in collection {collection_id} not found"
            )

But from the stac-api refresh is never passed. Am I wrong?

Should we hardcode 'wait_for' or at least use the kwargs in some way?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions