Skip to content

[bug] documents.import_ function signature requires return_id or return_doc when neither is required #74

@rchui

Description

@rchui

The function signature for documents.import_ is incorrect. The function signature requires that either return_id or return_doc be passed as a parameter as part one of:

DocumentImportParameters: typing.TypeAlias = typing.Union[
    DocumentImportParametersReturnId,
    DocumentImportParametersReturnDoc,
    DocumentImportParametersReturnDocAndId,
]

but the documentation does not require either. you should just be able to just pass the import action:

documents = [{
  'id': '124',
  'company_name': 'Stark Industries',
  'num_employees': 5215,
  'country': 'USA'
}]

# IMPORTANT: Be sure to increase connection_timeout_seconds to at least 5 minutes or more for imports,
#  when instantiating the client

client.collections['companies'].documents.import_(documents, {'action': 'create'})

https://typesense.org/docs/28.0/api/documents.html#index-multiple-documents

Metadata

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