Typesense rocks my friends! :smiley: Now, I just ...
# community-help
j
Typesense rocks my friends! 😃 Now, I just got a question regarding the id field. I read that if the field is a string and does not contain characters that would require URL encoding, the id field would actually be used to identify a document. Correct? It just happened that in order to update a document I upserted a document with the same exact id. And it seems like it created a second entry... How do I know if the id field is actually used as the actual document identifier? What would you recommend in my case? Currently running with these versions: https://cdn.jsdelivr.net/npm/algoliasearch@4.5.1/dist/algoliasearch-lite.umd.js https://cdn.jsdelivr.net/npm/instantsearch.js@4.8.3/dist/instantsearch.production.min.js https://cdn.jsdelivr.net/npm/typesense-instantsearch-adapter@1.2.1-7/dist/typesense-instantsearch-adapter.min.js
j
field is a string and does not contain characters that would require URL encoding, the id field would actually be used to identify a document. Correct?
That's correct. Could you do one or more search(es) that will return these two items? That will include the ID field in the response
j
Does it need to be through the API or could I do it manually in the cloud db interface?
j
Sure, you can do it in the cloud search interface as well
j
OK!
j
You can then look at the network requests in the browser to the see the exact API response
j
OK perfect
And there it will be possible to see if the id is the identifier?
j
Yeah it will show you the IDs used or assigned
j
👍
This is the duplication. Where do I see the network request?
j
In the browser's dev tools, under the network tab
j
😅Sure, and in the API response, where do I look to check the actual identifier?
j
If you search for an API call to
multi_search
, then click on the "Preview" for that response, and expand
results
, then
hits
and then the
document
object inside each hit
j
OK, I FOUND IT. It's a space that I forgot to trim at the end of the ID!!!
😅 1
But how would it look if the document identifier would be another one? There would be another field there?
j
Didn't get you... Could you give me an example?
j
Trying to delete the dupe there is an error - what do you suggest?
Let's try to explain better: in case the id field is not used as the identifier (it is possible, correct?), the document identifier would actually be a auto-generated id, right? Would I see this identifier in each document? What would its name be?
j
the document identifier would actually be a auto-generated id, right?
Correct.
Would I see this identifier in each document?
Yup.
What would its name be?
It will be called
id
and it will be an incrementing number
j
So we would have 2 fields named "id" then?
j
No, if there is a field called
id
in the document that will be used as the identifier field
j
Ok then!
j
Trying to delete the dupe there is an error - what do you suggest?
Could you post the full JSON of this document you're trying to delete?
j
Does this help?
I did not try to delete through the API, only through the cloud interface...
Request failed with HTTP code 404 | Server said: Could not find a document with id: ART41554-4742%20
j
Hmm, I think this might be a bug. To confirm, could you try deleting this document via the API?
So send a DELETE request to /collections/<name>/documents/<url encoded document_id>
j
Let's see... but it seems like we hit the actual problem of having a char that is URL encodable... the space character!
API replied "Could not find a document with id: ART41554-4742%20"
🤔
j
Could you open a Github issue for this, with a minimal replicateable example?
j
OK, but what it the start of the URL to send the DELETE request to?
j
Your Typesense cluster hostname
j
OK
j
Something like
<https://xxx-1.a1.typesense.net>
j
curl -X DELETE https://cloud.typesense.org/clusters/1ow83v9khrefbpump/collections/arts/documents/ART41554-4742%20 But I guess I need to identify, 'cause the above did not work
j
OK got it
Seems like a tricky one Jason... reply from the DELETE request: {"message": "Could not find a document with id: ART41554-4742%20"}
j
Yeah, this is a bug. Could you create a Github issue for it?
👍 1
j
OK I will
Hi Jason, just received this notification: Fixed in
0.23.0.rc54
Could you let me know where I can find the fix for the issue? Sorry I could not find it...
j
Since you're using Typesense Cloud, could you email support@typesense.org with your cluster ID? We can then upgrade your cluster to this RC build
Do you have a dev/staging environment that you can first test with?
j
No, don't have a dev/staging anymore
But OK, I can email support