I am trying to use N1QL and FTS in the same query and for an unknow reason the FTS index is not used
This is my query:
SELECT meta().id
FROM `images_fts`as t1
WHERE SEARCH(t1,`{"query": {"match_phrase": "apple", "field":"pp"}, "score": "none"}, {"index": "image_fts-v2"})
if I use the same expression: {"query": {"match_phrase": "apple", "field":"pp"}, "score": "none"}
in the fts I am getting instant results, but with the N1QL it just doesn’t use the index
here is the query plan:
{
"plan": {
"#operator": "Sequence",
"~children": [
{
"#operator": "Sequence",
"~children": [
{
"#operator": "PrimaryScan3",
"as": "t1",
"index": "#primary",
"index_projection": {
"primary_key": true
},
"keyspace": "images_fts",
"namespace": "default",
"using": "gsi"
},
{
"#operator": "Fetch",
"as": "t1",
"keyspace": "images_fts",
"namespace": "default"
},
{
"#operator": "Parallel",
"~child": {
"#operator": "Sequence",
"~children": [
{
"#operator": "Filter",
"condition": "search(`t1`, {\"query\": {\"field\": \"pp\", \"match_phrase\": \"apple\"}, \"score\": \"none\"}, {\"index\": \"image_fts-v2\"})"
},
{
"#operator": "InitialProject",
"result_terms": [
{
"expr": "(meta(`t1`).`id`)"
}
]
}
]
}
}
]
},
{
"#operator": "Limit",
"expr": "10"
}
]
}
}
@vsr1 can you please hint me what I am doing wrong?