I'm using the JavaScript API for Algolia and I'm trying to check for the existence of a single record. The API has clear documentation for how to do this where the ObjectID is known ( index.getObject
), but I need to check for the existence of a single result based on a different attribute:
post_id: 10050
objectID: 55345
In this case, the post_id
is being set by the CMS and I want to query the Algolia index to check whether it exists (or not).
So far, this code seems to do the trick:
index.search({
filters: 'post_id: 10050',
})
I'm not sure how performant this is, but it achieves the required result at the moment.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.