Skip to content

ES:Failed to parse mapping: Field [similarity] requires field [index] to be configured #10547

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

Closed
5 tasks done
huanshare opened this issue Nov 11, 2024 · 2 comments · Fixed by #10592
Closed
5 tasks done
Assignees
Labels
👻 feat:rag Embedding related issue, like qdrant, weaviate, milvus, vector database.

Comments

@huanshare
Copy link
Contributor

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.10.2

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

When using es as the vector library and uploading a file, an error is reported during parsing: BadRequestError(400, 'mapper_parsing_exception', 'Failed to parse mapping: Field [similarity] requires field [index] to be configured').

es version:8.9.1

✔️ Expected Behavior

Parsing success

❌ Actual Behavior

Field [similarity] requires field [index] to be configured')

I change this,it works
WX20241111-180101@2x

Copy link

dosubot bot commented Nov 11, 2024

To resolve the 'Failed to parse mapping: Field [similarity] requires field [index] to be configured' error in Elasticsearch version 8.9.1, you need to ensure that the index parameter is set in the mapping for the dense_vector field. The error indicates that the similarity parameter requires the index parameter to be explicitly configured.

In your code, the mapping for the dense_vector field should be updated as follows:

Field.VECTOR.value: {
    "type": "dense_vector",
    "dims": dim,
    "similarity": "cosine",
    "index": True  # or False, depending on your needs
}

Make sure to update the mapping in the create_collection method where the index is created. This should resolve the error by ensuring that the index parameter is configured as required by Elasticsearch [1].

To continue talking to Dosu, mention @dosu.

@dosubot dosubot bot added the 👻 feat:rag Embedding related issue, like qdrant, weaviate, milvus, vector database. label Nov 11, 2024
@JohnJyong JohnJyong self-assigned this Nov 11, 2024
@JohnJyong
Copy link
Collaborator

JohnJyong commented Nov 12, 2024

for 8.9 version
image
for 8.11 version
image
the index field is optional, but the default value have changed to 'true' from 8.11 version, It's really speechless, anyway, we will add this parameter soon @huanshare

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👻 feat:rag Embedding related issue, like qdrant, weaviate, milvus, vector database.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants