FTS - Boolean Type Mapping

Hey guys,

we have a situation where we would only want to index documents whose deleted value is set to false. For example, suppose we have documents like this:

DOC_ID: 6161
{
    "data": "something",
    "deleted": false
}
DOC_ID: 0000
{
    "data": "something",
    "deleted": true
}

In this situation, I want FTS to only index the document with the id of 6161. To achieve this, I set JSON type field to deleted. Then I create a type mapping with false value and disable default type. But this does not work. When I change deleted fields in documents to a string value like “true” instead of true, then it works. It seems like it cannot create a type mapping from a boolean value.

Can you help us with this?

@Emre_Kumas , to only index those documents that qualify a filter - you’re definitely attempting the right approach.

However, type_field will need the value of the JSON field to be a “string”.
Using false will therefore not work - because it’s boolean.

If possible, try replacing the “deleted” field value with a string instead and your exact index mapping should do the trick for you.

So your documents would be …

DOC_ID: 6161
{
    "data": "something",
    "deleted": "false"
}
DOC_ID: 0000
{
    "data": "something",
    "deleted": "true"
}
1 Like

Hmm, I see. I guess its the only way we can do. Wish FTS could create the type field from any primitive values like boolean, number etc. other than just string.

Thanks for your reply.