Term on N1QL + SEARCH not working when value has many words like 'Practitioner/3033112248320'

I have index a field specifically.

“types”: {
“my-scope.Session”: {
“dynamic”: false,
“enabled”: true,
“properties”: {
“actor”: {
“dynamic”: false,
“enabled”: true,
“properties”: {
“reference”: {
“dynamic”: false,
“enabled”: true,
“fields”: [
{
“analyzer”: “keyword”,
“index”: true,
“name”: “reference”,
“type”: “text”
}
]
}
}
},

If I search FTS WEB UI directly, I get value.

{
“size”: 300,
“from”: 0,
“fields”: [
“*”
],
“query”: {
“must”: {
“conjuncts”: [
{
“field”: “actor.reference”,
“term”: “Practitioner/1014733033112248320”
}
]
}
},
“explain”: true
}

However, when I use N1QL + SEARCH, its. not returning

SELECT d.*
FROM mybucket.my-scope.Session d
WHERE SEARCH(d, {“must”:{“conjuncts”:[
{“field”:“actor.reference”,“term”:“Practitioner/1014733033112248320”}]}}
)
LIMIT 100
OFFSET 0

This does not return any value.

I suspect that ‘term’ used in N1QL + SEARCH is still tokenising the query value?

I have added ‘analyzer’: ‘keyword’ to the query. still does not work.

SELECT d.*
FROM mybucket.my-scope.Session d
WHERE SEARCH(d, {“must”:{“conjuncts”:[
{“field”:“actor.reference”,“term”:“Practitioner/1014733033112248320”, “analyzer”: “keyword”}]}}
)
LIMIT 100
OFFSET 0

I have tried ‘match’ instead of ‘term’. still not working.

Please help.

Couchbase Server Enterprise Edition 8.0.0 build 3777

Hi @ssatthy! I tried reproducing the issue, and it seems to be working for me. Could you provide any more details?

@capemox Thank you for responding.
When I use FTS, I get results. screenshot below.

When I use n1ql, I don’t get results,

its because the value is “Practitioner/1014733034915799040“.

if I try for single ‘word’, fts and n1ql both returns results.

screenshots.

So my assumption is that even though I specify ‘term’ in n1ql, the query analyzer is still tokenising the value ‘Practitioner/1014733034915799040‘ to ‘Practitioner’ and ‘1014733034915799040’, hence not matching the exact value of the field ‘actor.reference’ which is indexed as type: ‘text’, analyzer: ‘keyword’

Please let me know if anything specific I can provide. not sure what else I can provide.