I have a collection that has a text index like this:
db.mycollection.createIndex({ "$**" : "text"},{ "name" : "AllTextIndex"}))
The collection's documents have many text data blocks. I want to exclude some of them in order to not get results that includes text matched from the excluded blocks.
However, I don't want to define each field in the text index like below in order to exclude the, for example, NotTextSearchableBlock
block:
db.application.ensureIndex({
"SearchableTextBlock1": "text",
"SearchableTextBlock2": "text",
"SearchableTextBlock3": "text"
})
Here is a document example:
{
"_id": "e0832e2d-6fb3-47d8-af79-08628f1f0d84",
"_class": "com.important.enterprise.acme",
"fields": {
"Organization": "testing"
},
"NotTextSearchableBlock": {
"something": {
"SomethingInside": {
"Text":"no matcheable text"
}
}
},
"SearchableTextBlock1": {
"someKey": "someTextCool"
},
"SearchableTextBlock2": {
"_id": null,
"fields": {
"Status": "SomeText"
}
},
"SearchableTextBlock3": {
"SomeSubBlockArray": [
{
"someText": "Pepe"
}
]
}
}