Hello, I've found a bug in version 0.25.0.rc63. Wh...
# community-help
b
Hello, I've found a bug in version 0.25.0.rc63. When I try to Update or Emplace a document I receive this error: `POST ../documents?action=emplace -> "message": "No valid fields found to create embedding for
embedding
, please provide at least one valid field or make the embedding field optional." with payload:`
{
"id": "602",
"about": "test"
}
this also happens with
action=update
k
Hi Bill. Is the field already optional in the schema?
b
No the embedding field is not optional
k
I actually fixed a bug which was not enforcing this.
b
I didn't have this issue with previous versions
k
This is for auto embedding?
b
Yes
k
Ok maybe that was not considered. I'll look shortly. Would you be able to post a small snippet that reproduces the issue?
b
Ok
In order to reproduce it, Create the collection
curl "<http://localhost:8108/collections>" \
-X POST \
-H "Content-Type: application/json" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
-d '
{
"name": "products",
"fields": [
{
"name": "product_name",
"type": "string"
},
{
"name": "about",
"type": "string"
},
{
"name": "embedding",
"type": "float[]",
"embed": {
"from": [
"product_name",
"about"
],
"model_config": {
"model_name": "ts/paraphrase-multilingual-mpnet-base-v2"
}
}
}
]
}
'
Index a doc
curl "<http://localhost:8108/collections/products/documents/import?action=create>" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
-H "Content-Type: text/plain" \
-X POST \
-d '
{"product_name": "ABCD","about": "This is some description text"}
'
Update the doc
curl "<http://localhost:8108/collections/products/documents?action=emplace>" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
-H "Content-Type: text/plain" \
-X POST \
-d '
{"id": "1","about": "Test"}
'
k
Thanks, will fix shortly. Regression introduced in rc63 or rc62
b
Ok
k
Wait, the update doesn't have the field
product_name
b
I want to update only the about field, I use emplace for this reason
k
Ok got it.
this also happens with
action=update
But it works with action=update for me.
And your earlier error message at the start of the thread is different
Copy code
No valid fields found to create embedding for `embedding`, please provide at least one valid field or make the embedding field optional.
Is that a different issue?
b
I use emplace to update part of the doc such as the about filed. I tried with update in order to check it, but I got the same error message:
Copy code
No valid fields found to create embedding for `embedding`, please provide at least one valid field or make the embedding field optional.
The main method I use to update docs is Emplace
k
Ok. Let me investigate further.
b
Ok
In order to reproduce it, just use emplace with only "id" and "about" fields
k
What message do you get when you run the above curl but with action=update instead of emplace?
b
If i use update with this payload (without product_name) I get this error: { "message": "No valid fields found to create embedding for
embedding
, please provide at least one valid field or make the embedding field optional." }
I don't use Update method because it requires the full doc. I use only Emplace and update specific fields.
k
@Bill There is an issue with the example above. For emplace
"id": "1",
is sent as the record ID. But the first record that gets indexed via
action=create
will actually get id: 0
b
Yes my mistake id: 0
k
With that change, it works for me 🤔
Can you try the above?
b
Ok i'll try it
I get the same error: { "message": "No valid fields found to create embedding for
embedding
, please provide at least one valid field or make the embedding field optional." }
I think i found the bug
If you create the collection with this payload: { "name": "products", "fields": [ { "name": "product_name", "type": "string" }, { "name": "about", "type": "string" }, { "name": "embedding", "type": "float[]", "embed": { "from": [ "product_name" ], "model_config": { "model_name": "ts/paraphrase-multilingual-mpnet-base-v2" } } } ] }
Index a doc
k
Hmm then how is it working for me 🤔 are you using the deb? Maybe I'm not reproducing it properly.
b
and use emplace
I use rc63
k
Model name matters?
b
maybe
The "embed" field doesnt contain about also
Yes that's it, I tried with your payload also
If you add in "embed" field the "about", the emplace works
k
Yup I can reproduce now.
b
if the embed field doesn't have the "about" field it doesn't
k
Will check, thanks for the help!
b
No problem
j
@Bill We just published 0.25.0.rc65. Could you try replicating the issue?
b
Ok I’ll test it in an hour
👍 1
@Kishore Nallan @Jason Bosco Perfect, it works now! 🙌
😅 1
🙌 1
The filter_by is available only in UPDATE method?
<http://localhost:8108/collections/docs/documents?filter_by=$FILTER_CLAUSE>
I used this curl but I get num_updated:0
j
Could you give me a set of curl commands that create a collection, adds a few docs and then updates the docs by filter to replicate the issue? Here’s a template to use.
b
I had a typo in the curl I sent. My mistake, it works great
👍 1
@Jason Bosco @Kishore Nallan I found the bug. The filter_by doesn't work for multiple doc updates when the field that you use is not set to "index": true. For example, if the field has this structure:
{
"facet": *false*,
"index": *false*,
"infix": *false*,
"locale": "",
"name": "productID",
"optional": *true*,
"sort": *false*,
"type": "string"
},
The response using this curl:
curl "<http://localhost:8108/collections/docs/documents?filter_by=productID:=Test>" -X PATCH \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -d '{"title": "Title with 1000 points."}'
is ->
{
"num_updated": 0
}
If the field that I use in filter_by is set to index: true -> num_updated: 1
k
This is expected.
index: false
mean no indices will be available to do any operation. This includes searching, filtering or sorting.
In other words
index: false
field is as good as a stored field that's not part of schema.
The only reason we have it is when sometimes you want to use regexp or nested fields where you want some patterns to be indexed in-memory and some to not be. In those cases
index: false
is useful to indicate which should be excluded.
b
I don't return this field in search results and it's like an id in the doc. so I though it should be not indexed, that's why i set it to index: false
Ok, i'll set it to index: true, thank you Kishore
👍 1