Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Specify index_name while creating llama-index MilvusVectorStore instance #17308

Open
legacy-dev6 opened this issue Dec 18, 2024 · 0 comments
Labels
enhancement New feature or request triage Issue needs to be triaged/prioritized

Comments

@legacy-dev6
Copy link

Feature Description

Im working on a python rag project. where im using milvus as vector database and using llama-index for setting up the project.

I have done setting up milvus database, wrote code for embedding the documents, in milvus collection i have created a schema and added 3 indexes. among those 2 are scalar indexes and one is a vector index.

def _create_indexes(self, collection: Collection):
        """Create indexes on the collection"""
        try:
            collection.drop_index()
        except Exception as e:
            logger.warning(f"No existing indexes to drop: {e}")

        collection.create_index(field_name="account_id", index_name="account_id_index")
        collection.create_index(field_name="file_id", index_name="file_id_index")

        index_params = {
            "index_type": "IVF_FLAT",
            "metric_type": "IP",
            "params": {"nlist": self.config.nlist},
        }
        collection.create_index(
            field_name="embedding",
            index_params=index_params,
            index_name="embedding_index",
        )
        collection.load()

Milvus is getting populated successfully, all 3 indexes are also getting created.
i got the following when i logged the index details

2024-12-17 17:24:17 - milvus - INFO - Index details - Field: account_id, index_name: account_id_index Type: {}
2024-12-17 17:24:17 - milvus - INFO - Index details - Field: file_id, index_name: file_id_index Type: {}
2024-12-17 17:24:17 - milvus - INFO - Index details - Field: embedding, index_name: embedding_index Type: {'index_type': 'IVF_FLAT', 'metric_type': 'IP', 'params': {'nlist': 4096}}

After this, for doing the similarity search i was trying to create an instance of MilvusVectorStore
in the following way.

self._store = MilvusVectorStore(
                uri=self.config.uri,
                collection_name=collection_name,
                dim=self.config.embedding_dim,
                similarity_metric="IP",
                embedding_field="embedding",
                index_name="embedding_index",
                search_config={
                    "metric_type": "IP",
                    "params": {"nprobe": self.config.nprobe},
                    "index_name": "embedding_index",
                },
                index_config={
                    "field_name": "embedding",
                    "index_type": "IVF_FLAT",
                    "metric_type": "IP",
                    "params": {"nlist": self.config.nlist},
                    "index_name": "embedding_index",
                },
            )

but, since i have multiple indexes, im getting the following error(that's what error says)

 pymilvus.decorators - ERROR - RPC error: [describe_index], <AmbiguousIndexName: (code=1, message=There are multiple indexes, please specify the index_name.)>, <Time:{'RPC start': '2024-12-17 17:24:17.551945', 'RPC error': '2024-12-17 17:24:17.584774'}>

i couldnt find anywhere how to i specify the index_name during this, (error is asking for me to do it)
It looks like there is no way or feature to specify index_name during the initialization of MilvusVectorStore instance.

Reason

No response

Value of Feature

No response

@legacy-dev6 legacy-dev6 added enhancement New feature or request triage Issue needs to be triaged/prioritized labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triage Issue needs to be triaged/prioritized
Projects
None yet
Development

No branches or pull requests

1 participant