FTS inside array



I am trying to search inside arrays when elements are objects.

{ “tshirts”: [ {“size”:“large”,“color”:“red”},{“size”:“small”,“color”:“blue”} ] }


+tshirts.size:large +tshirts.color:blue

returns false positive results finding size in the first sub-object and color in the second sub-object.
I guess it is due to the fact that tshirts.size and tshirts.color are indexed independently.

Is there any way of coupling size and color either at the indexing time or at query time?

Igor S



try with double qoutes +tshirts.size:“large” +tshirts.color:“blue”


No luck, the same problem. FTS finds size and color in different tshirts array entries.



So do you want a way to find this below ?

{ “tshirts”: [ {“size”:“large”,“color”:“blue”},{“size”:“small”,“color”:“green”} ] }

where both of them are in the same object in an array not in the same array?

Do you need FTS? Can you use N1QL?

ANY i IN tshirts SATISFIES i.size = "large" AND i.color = "blue" END;


As you have observed FTS currently does not have a query type that requires child queries elements to all be satisfied by the same array elements. The index has the required information, we just don’t yet offer a way to express the query. I’ll pass this feature along for future consideration.



Thank you for the proposed solution.
It is definitely possible to use N1QL for the presented example.
Nevertheless , sometimes FTS is the only option.
Consider, for example, theaters with array of playing movies when each movie element has a title and playing times. To find a theater by movie title (potentially partial) and playing time is definitely a task for FTS.



Thank you for the reply.
I think it is an essential feature to have.
Without it search within arrays of objects is very limited.
Solr does it by block joins. DataStax Enterprise by tuple query parser.
Is there any way to plug in a custom FTS indexing code?


Currently FTS allows for advanced configuration, but does not allow for any custom code execution.


I have a similar problem here, I don´t know if this limitation is solved right now in couchbase 5.5.2
Please, can anybody tell me this



This is not yet prioritised for a particular release, And thanks for bringing this back on radar,
Certainly more such user queries helps us in prioritising this over the backlog.
Meantime, you may also share more insight into your exact use case, else we may presume that its precisely similar to above mentioned thread.