Path hierarchy mapping migration issue

Hi!
I'm trying to upgrading my 1.7 cluster to 5.2.x but I'm encontering some troubles
Here is my original working 1.7 default mapping:

{
  "template" : "tf*",
  "settings" : {
    "index.refresh_interval" : "5s",
    "analysis": {
      "analyzer": {
        "path-analyzer": {
          "type": "custom",
          "tokenizer": "path-tokenizer"
        }
      },
      "tokenizer": {
        "path-tokenizer": {
          "type": "path_hierarchy"
        }
      }
    }
  },
  "mappings" : {
    "_default_" : {
       "_all" : {"enabled" : true},
       "dynamic_templates" : [ {
         "string_fields" : {
           "match" : "*",
           "match_mapping_type" : "string",
           "mapping" : {
             "type" : "string", "index" : "analyzed", "omit_norms" : true,
               "fields" : {
                 "raw" : {"type": "string", "index" : "not_analyzed", "ignore_above" : 256}
               }
           }
         }
       } ],
       "properties" : {
         "path"    : {
          "type": "string",
          "index_analyzer": "path-analyzer",
          "search_analyzer": "keyword",
          "fields": {
            "raw": {
              "index": "not_analyzed",
              "type": "string"
            }
          }
        }
      }
    }
  }
}

My last attempt:

{
  "template": "tf*",
  "settings": {
    "index.refresh_interval": "5s",
    "analysis": {
      "analyzer": {
        "pathAnalyzer": {
          "tokenizer": "path_hierarchy"
        }
      }
    }
  },
  "mappings": {
    "_default_": {
      "_all": {
        "enabled": true
      },
      "dynamic_templates": [
        {
          "string_fields": {
            "match_mapping_type": "string",
            "mapping": {
              "type": "keyword",
              "omit_norms": true,
              "fields": {
                "raw": {
                  "type": "text",
                  "ignore_above": 256
                }
              }
            }
          }
        }
      ],
      "properties": {
        "path": {
          "type": "keyword",
          "analyzer": "pathAnalyzer",
          "fields": {
            "raw": {
              "type": "text"
            }
          }
        }
      }
    }
  }
}

The error is that analyzer pathAnalyzer is an invalid parameter

Any ideas?

Thanks

Thanks to Xylakant from the IRC channel the issue was resolved by changing the type from keyword to text in the path property definition

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