Specifying default custom analyzer

Hi,

I'm working on upgrading out cluster to newer ES version. one of the template mapping that used to work on the old version doesn't work on the newer version.

I checked the document, there no mention that this behavior was changed in newer ES versions. One web posting that i came across suggest that I name my default custom analyzer 'standard' to override the standard. I haven't try that out yet. What is the correct way of defining default analyzer for an index?

template mapping:

{
    "mappings": {
        "analyzer": "custom_csv_lowercase",
        "my_doc_type": {
            "_all": {
                "enabled": false
            },
            "properties": {
                "my_field": {
                    "type": "string",
                    "analyzer": "custom_csv_lowercase"
                }
            }
        }
    },
    "order": 1,
    "settings": {
        "analysis": {
            "analyzer": {
                "custom_csv_lowercase": {
                    "filter": ["lowercase"],
                    "tokenizer": "commas",
                    "type": "custom"
                }
            },
            "tokenizer": {
                "commas": {
                    "pattern": ",+",
                    "type": "pattern"
                }
            }
        }
    }
}

Error i'm getting when i try to push the template to ES:

{
  "status": 400,
  "error": {
    "caused_by": {
      "reason": "Root mapping definition has unsupported parameters:  [analyzer : custom_csv_lowercase]",
      "type": "mapper_parsing_exception"
    },
    "reason": "Failed to parse mapping [my_doc_type]: Root mapping definition has unsupported parameters:  [analyzer : custom_csv_lowercase]",
    "type": "mapper_parsing_exception",
    "root_cause": [
      {
        "reason": "Root mapping definition has unsupported parameters:  [analyzer : custom_csv_lowercase]",
        "type": "mapper_parsing_exception"
      }
    ]
  }
}

Thanks,
GC

1 Like

answering my own question again. the way to do it is to name the analyzer 'default'.

1 Like

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