How to use LIKE on a field containing dynamic object

Consider following documents:

{
	"property" : {
		"field1" {
			"innerField" : " this needs to be searchable"
		},
		"filed2" : {
			"array" : ["some val", "val"]
		}
	}
},
{
	"property" : {
		"nextField" "searchable value."
		"filed2" : {
			"innerField" : 123456
		}
	}
}

consider that the property is static (exists in every document) but a content is dynamic (Object). It is possible somehow using N1QL search for all documents which contain given term? Using Couchabse 4.5.

SELECT * FROM `bucket` WHERE `property` LIKE '%term%';

It is possible create an index on dynamic filed which stringify all the properties and make them search-able?
What is the recommended approach to this issue?

Same answer as Stack Overflow, but happy to continue the conversation here.

The answer you posted is not a solution for given problem. You’ve provided just a snipped how to create an index over an email column but I would need an index which allows me do a search query for strings/substrings on given dynamic property. Basically what a SQL LIKE does. Thanks for help!

No worries. I suspect there’s a misunderstanding. N1QL can perform queries without an index for every condition.

Ok, thanks. So what is the answer for this issue? How can I do a LIKE %term% over a dynamic object using Couchabse 4.5?

Couchbase 4.6 has a feature to stringify and search WHOLE WORDS…

If you need full-text search, you can use Couchbase FTS (in Beta for 4.5 and 4.6).

Thanks for the link!

I don’t quite need Full-text search. I just need to be able search for substring in a dynamic object using CB 4.5. It looks like it is not possible in the current version.

For 4,5, use the query and index from Stack Overflow. If the query doesn’t work, post the exact query and error here.