Specifying default custom analyzer


(gchen) #1

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


(gchen) #2

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


(system) #3

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