How to execute case sensitive searches in a Slicer


#1

I have a Slicer that is grouped by a string column from a specific Elasticsearch index. The Slicer is sorted ascending, and I have a default limit of 1000. My problem is that when I do a filter search on that column, for example, some element beyond the 1000 that were initially loaded, I have to specify the case so that it brings me the data I’m looking for, otherwise it doesn’t find anything.

What configuration should I do in the Slicer or some workaround to achieve this?

I would greatly appreciate any help on this.


#2

Hi @dev.tree , thanks for reaching out. Could you please share how the index mappings are made up?, I mean only the part of the field with which you are doing the search.


#3

Hello @juan.dominguez, this is the part of the mappings configuration, and my field is configured like this:

{
    "settings" : {
        "number_of_shards" : 1
    },
    "mappings" : {
        "properties": {          
            "my_search_field": {
                "type": "keyword"
            },
            ...          
        }
    }
}

Thanks…


#4

To achieve a sensitive case search in Elasticsearch, you need to configure the field as text type together with keyword type. You can find more information about it in the following link: https://www.elastic.co/guide/en/elasticsearch/reference/current/text.html#text-multi-fields.

But in any case, your field should be defined with a configuration like this:

{
    "settings" : {
        "number_of_shards" : 1
    },
    "mappings" : {
        "properties": {          
            "my_search_field": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
            },
            ...          
        }
    }
}

You can try with this configuration and let me know if this was able to solve your requirement.


#5

Excellent, that works wonders. Thank you!