Problem with analyzer

Hi everyone,

I am trying to parse out two fields in my data "Relation_consomme" and "Relation_utilise" but when defining the mapping, Dev_Tools returns me the following error :

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

here is my mapping :

PUT cata
{
  "settings": {
    "analysis": {
            "analyzer" : {
                "comma" : {
                    "type" : "custom",
                    "tokenizer" : "motif",
                    "filter" : ["trim"]
                }
            },
            "tokenizer" : {
                "motif" : {
                    "type" : "pattern",
                    "pattern" : "\\,+"
                }
            }
    }
  }
}


PUT cata/_mapping
{
   "properties":{
      "ID":{
         "type":"integer"
      },
      "Identifiant":{
         "type":"keyword"
      },
      "Portée Groupe":{
         "type":"keyword"
      },
      "Donnée":{
         "type":"keyword"
      },
      "Descriptif":{
         "type":"keyword"
      },
      "Domaine":{
         "type":"keyword"
      },
      "Mail Resp Appli":{
         "type":"keyword"
      },
      "Partage":{
         "type":"keyword"
      },
      "Propriétaire":{
         "type":"keyword"
      },
      "Direction":{
         "type":"keyword"
      },
      "Service":{
         "type":"keyword"
      },
      "Nom propriétaire":{
         "type":"keyword"
      },
      "Prénom propriétaire":{
         "type":"keyword"
      },
      "Mail":{
         "type":"keyword"
      },
      "Norme interne":{
         "type":"keyword"
      },
      "Support":{
         "type":"keyword"
      },
      "Nom objet":{
         "type":"keyword"
      },
      "Code_Objet":{
         "type":"keyword"
      },
      "Maitre":{
         "type":"keyword"
      },
      "Actif":{
         "type":"keyword"
      },
      "Doublon":{
         "type":"keyword"
      },
      "Description":{
         "type":"keyword"
      },
      "Nom maitre":{
         "type":"keyword"
      },
      "Gestionnaire":{
         "type":"keyword"
      },
      "Direction gest":{
         "type":"keyword"
      },
      "Service gest":{
         "type":"keyword"
      },
      "Nom gest":{
         "type":"keyword"
      },
      "Prénom gest":{
         "type":"keyword"
      },
      "Mail gest":{
         "type":"keyword"
      },
      "Anglais":{
         "type":"keyword"
      },
      "Frequence maj":{
         "type":"keyword"
      },
      "Description fonct":{
         "type":"keyword"
      },
      "Descript fonct comp":{
         "type":"keyword"
      },
      "Id métier":{
         "type":"keyword"
      },
       "Relation_consomme": {
          "type": "text",
          "index": false,
          "fields": {
            "analyse_comma": { 
              "type":  "keyword",
              "analyzer" : "comma"
            }
          }
       },
       "Relation_utilise": {
          "type": "text",
          "index": false,
          "fields": {
            "analyse_comma": { 
              "type":  "keyword",
              "analyzer" : "comma"
            }
          }
       },
      "Type donnée":{
         "type":"keyword"
      },
      "RGPD":{
         "type":"keyword"
      },
      "OFAC":{
         "type":"keyword"
      },
      "Data_2":{
         "type":"keyword"
      },
      "Data_3":{
         "type":"keyword"
      },
      "Data_4":{
         "type":"keyword"
      },
      "Data_5":{
         "type":"keyword"
      },
      "Data_6":{
         "type":"keyword"
      },
      "Criticité":{
         "type":"keyword"
      }
   }
}

Can anyone help,

You can't define an analyzer if the type is ``keyword`. Only normalizers are allowed.

I have changed type to keyword but kibana give me the following error when trying to create a visualization :

Error in visualization
Request to Elasticsearch failed: {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [Relation_consomme.analyse_comma] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"cata","node":"ynSCKa1MQviZRjG6Esuvpw","reason":{"type":"illegal_argument_exception","reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [Relation_consomme.analyse_comma] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."}}],"caused_by":{"type":"illegal_argument_exception","reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [Relation_consomme.analyse_comma] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.","caused_by":{"type":"illegal_argument_exception","reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [Relation_consomme.analyse_comma] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."}}},"status":400}

You can't run aggs or sort on text fields.
You need either a keyword type or explicitly use fielddata for text fields (and understand the consequences in term of HEAP usage).

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