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

[Bug]: On create index pymilvus throws - MilvusException: (code=1, message=invalid index type: IVF_FLAT #27479

Closed
1 task done
bhaskars-repo opened this issue Oct 5, 2023 · 1 comment
Assignees
Labels
kind/bug Issues or changes related a bug needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@bhaskars-repo
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Environment

- Milvus version: 2.3.1
- Deployment mode(standalone or cluster): standalone
- MQ type(rocksmq, pulsar or kafka):    
- SDK version(e.g. pymilvus v2.0.0rc2): pymilvus 2.3.1
- OS(Ubuntu or CentOS): Ubuntu
- CPU/Memory: 16 Cores/64 GB
- GPU: NVidia 3070
- Others:

Current Behavior

Trying to create an index on a collection throws and exception:

pymilvus.exceptions.MilvusException: <MilvusException: (code=1, message=invalid index type: IVF_FLAT")>

Expected Behavior

No response

Steps To Reproduce

The following is the definition of the collection:

    def_news_category = 'General'
    # Define the fields of the schema
    news_id = FieldSchema(
        name='news_id',
        dtype=DataType.INT64,
        is_primary=True
    )
    news_category = FieldSchema(
        name='news_category',
        dtype=DataType.VARCHAR,
        max_length=15,
        default_value=def_news_category
    )
    news_snippet_text = FieldSchema(
        name='news_snippet_text',
        dtype=DataType.VARCHAR,
        max_length=256
    )
    news_snippet_vector = FieldSchema(
        name='news_snippet_vector',
        dtype=DataType.FLOAT_VECTOR,
        dim=200
    )
    # Define the collection
    collection_schema = CollectionSchema(
        fields=[news_id, news_category, news_snippet_text, news_snippet_vector],
        description="News Snippet Search",
        enable_dynamic_field=True
    )
    # Create the collection
    collection = Collection(
        name=collection_name,
        schema=collection_schema,
        using=alias
    )

The following is the snippet to create the index:

    field = 'news_snippet_vector'
    index_params = {
        'metric_type': 'L2',
        'index_type': 'IVF_FLAT"',
        'params': {'nlist': 128}
    }
    collection.create_index(field, index_params)

Milvus Log

RPC error: [create_index], <MilvusException: (code=1, message=invalid index type: IVF_FLAT")>, <Time:{'RPC start': '2023-10-05 16:33:58.394630', 'RPC error': '2023-10-05 16:33:58.395860'}>
Traceback (most recent call last):
File "/home/polarsparc/MyProjects/Python/Milvus/sample-1.py", line 168, in
main()
File "/home/polarsparc/MyProjects/Python/Milvus/sample-1.py", line 124, in main
create_index(field_name, collection)
File "/home/polarsparc/MyProjects/Python/Milvus/sample-1.py", line 71, in create_index
collection.create_index(field, index_params)
File "/home/polarsparc/MyProjects/Python/venv/lib/python3.10/site-packages/pymilvus/orm/collection.py", line 1208, in create_index
return conn.create_index(self._name, field_name, index_params, timeout=timeout, **kwargs)
File "/home/polarsparc/MyProjects/Python/venv/lib/python3.10/site-packages/pymilvus/decorators.py", line 127, in handler
raise e from e
File "/home/polarsparc/MyProjects/Python/venv/lib/python3.10/site-packages/pymilvus/decorators.py", line 123, in handler
return func(*args, **kwargs)
File "/home/polarsparc/MyProjects/Python/venv/lib/python3.10/site-packages/pymilvus/decorators.py", line 162, in handler
return func(self, *args, **kwargs)
File "/home/polarsparc/MyProjects/Python/venv/lib/python3.10/site-packages/pymilvus/decorators.py", line 102, in handler
raise e from e
File "/home/polarsparc/MyProjects/Python/venv/lib/python3.10/site-packages/pymilvus/decorators.py", line 68, in handler
return func(*args, **kwargs)
File "/home/polarsparc/MyProjects/Python/venv/lib/python3.10/site-packages/pymilvus/client/grpc_handler.py", line 876, in create_index
raise MilvusException(status.error_code, status.reason)
pymilvus.exceptions.MilvusException: <MilvusException: (code=1, message=invalid index type: IVF_FLAT")>

Anything else?

No response

@bhaskars-repo bhaskars-repo added kind/bug Issues or changes related a bug needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 5, 2023
@bhaskars-repo
Copy link
Author

Looking closely at the logs from stdout ... realized a silli mistake 'index_type': 'IVF_FLAT"', ... see the additional double quote ...
This is not an issue anymore ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Issues or changes related a bug needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
None yet
Development

No branches or pull requests

2 participants