Insensitive case sort error : "Mapping definition for [fields] has unsupported parameters: [analyzer : case_insensitive_sort]"

Hello,

I'm trying to configure an insensitive case sort in my ES 5.1.1 .
I have followed the ES documentation and I have create my mapping this way :

PUT g_config

POST g_config/_close

PUT g_config/_settings
{
   "index": {
      "analysis": {
         "analyzer": {
             "case_insensitive_sort": {
                "type": "custom",
    	          "tokenizer": "keyword",    
		          "filter":  [ "lowercase" ] 
		        }
         }
      }
   }
}

POST g_config/_open

PUT g_config/g_item/_mapping
{
   "properties": {
      "type": {
         "type": "keyword",
         "fields": {
            "lower_case_sort": {
               "type": "keyword",
               "analyzer": "case_insensitive_sort"
            }
         }
      }
   }
}

Unfortunately, it does not work. I have the following error :

{
   "error": {
      "root_cause": [
         {
            "type": "mapper_parsing_exception",
            "reason": "Mapping definition for [fields] has unsupported parameters:  [analyzer : case_insensitive_sort]"
         }
      ],
      "type": "mapper_parsing_exception",
      "reason": "Mapping definition for [fields] has unsupported parameters:  [analyzer : case_insensitive_sort]"
   },
   "status": 400
} 

Is there a bug or am I doing something wrong ?

Regards,
Pierre.

You cannot add analyzers to keyword fields. The keyword type does not allow it. In the future you will be able to do something similar to what you are trying using https://github.com/elastic/elasticsearch/pull/21919

Hello,
I have now installed ES 5.2.0 and I still have the same problem.
If I try to create my mapping like this :

PUT g_config/g_item/_mapping
{
   "properties": {
      "type": {
         "type": "keyword",
         "fields": {
            "lower_case_sort": {
               "type": "keyword",
               "analyzer": "case_insensitive_sort"
            }
         }
      }
   }
}

I receive the following error :

{
   "error": {
      "root_cause": [
         {
            "type": "mapper_parsing_exception",
            "reason": "Mapping definition for [fields] has unsupported parameters:  [analyzer : case_insensitive_sort]"
         }
      ],
      "type": "mapper_parsing_exception",
      "reason": "Mapping definition for [fields] has unsupported parameters:  [analyzer : case_insensitive_sort]"
   },
   "status": 400
} 

Is it not supposed to be fixed since this upgrade : https://github.com/elastic/elasticsearch/pull/21919 is in 5.2.0 ?

The issue introduced a normalizer parameter you can use with keyword fields. The documentation for it can be found here: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/normalizer.html

It is similar to an analyzer but gaurentees only a single terms is produced.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.