FTS search by id CB server 6.5

Hello,
I am trying to use fts search for searching by _id. Is there a possibility?
This is my query (as _id is already indexable, it should be searchable, but it is returning 0 hits):

“query”:{
“conjuncts”:[{“field”:“_id”,“match_phrase”:“prs_xxxx1”}]
}

Another try I had: I added to my FTS index definition _id field as well:


and then running query like

“query”:{
“conjuncts”:[{“field”:“id”,“match_phrase”:“prs_xxxx1”}]
}

And again no results :frowning_face:
Any ideas what is going wrong?
Thanks.

An “_id” field is indexed by the search engine internally to accommodate the doc IDs.
You should be able to use the Doc ID query to access the content of the _id field.

Here’s an example …

{"query": {"ids": ["prs_xxxx1"]}}

Here’s more - DocID Query | Couchbase Docs

1 Like

Thank you abhinav for your quick answer. It is working fine.