Wrong Mapping Syntax after upgrade, help needed


(James Cullimore) #1

Hi,
I'm in need of some help with my Mapping template.
I previously had Elasticsearch 1.7.3 which was accidentally upgraded to 5.4.3 within one of our work projects (its a complicated story). We could downgrade it back to its previous version but I would rather continue either with this version or even a further stable version.
After spending some time researching as to how it should be, I was unable to fully grasp how to convert my old mappings to the required standard. I'm reasonably new to Elasticsearch & am the only developer who works with it (a.t.m.) where I am.
The "technical environment, sizing, architecture, nodes..." should be in this case irrelevant due to it being a simple mapping template, however if this information is needed I will post it afterwards
The Mapping is as follows:

POST /_template/all
{
  "order": 0,
  "template": "*",
  "settings": {
    "index": {
      "analysis": {
        "filter": {
          "preserve_original": "true",
          "patterns": [
            "([a-zA-Z]+[-]+[a-zA-Z]+[-]+[0-9a-zA-Z])",
            "([0-9a-zA-Z]+[-]+[0-9a-zA-Z]+)",
            "([0-9a-zA-Z]+[_]+[0-9a-zA-Z]+)",
            "([p{L}d]+)"
          ]
        },
        "ascii_folding": {
          "type": "asciifolding",
          "preserve_original": true
        }
      },
      "analyzer": {
        "InsertAnalyzer": {
          "filter": [
            "lowercase",
            "preserve_original",
            "ascii_folding"
          ],
          "type": "custom",
          "tokenizer": "keyword"
        },
        "SearchAnalyzer": {
          "filter": [
            "lowercase",
            "ascii_folding"
          ],
          "type": "custom",
          "tokenizer": "whitespace"
        }
      }
    }
  },
  "mappings": {
    "cd-db": {
      "properties": {
        "Path": {
          "include_in_all": true,
          "fielddata": true,
          "analyzer": "InsertAnalyzer",
          "type": "text",
          "fields": {
            "keyword": {
              "ignore_above": 1000,
              "boost": 10,
              "type": "keyword"
            }
          }
        },
        "CD-ID": {
          "include_in_all": false,
          "type": "long"
        },
        "Files": {
          "type": "object",
          "properties": {
            "Size": {
              "enabled": false
            },
            "File": {
              "include_in_all": true,
              "fielddata": true,
              "analyzer": "InsertAnalyzer",
              "type": "text",
              "fields": {
                "keyword": {
                  "ignore_above": 1000,
                  "type": "keyword"
                }
              }
            }
          }
        },
        "Date": {
          "include_in_all": false,
          "format": "yyyy-MM-ddHH:mm:ss||yyyy-MM-dd||epoch_millis",
          "type": "date"
        }
      }
    },
    "new_document_service": {
      "properties": {
        "DocumentsSent": {
          "type": "integer"
        },
        "FilesSent": {
          "type": "integer"
        },
        "LastID": {
          "type": "integer"
        },
        "UpdateTime": {
          "include_in_all": true,
          "format": "yyyy-MM-dd@HH:mm:ss||epoch_millis",
          "type": "date"
        }
      }
    },
    "insert_service": {
      "properties": {
        "DocumentsSent": {
          "type": "integer"
        },
        "FilesSent": {
          "type": "integer"
        },
        "LastID": {
          "type": "integer"
        },
        "InsertTime": {
          "include_in_all": true,
          "format": "yyyy-MM-dd@HH:mm:ss||epoch_millis",
          "type": "date"
        }
      }
    },
    "_default_": {
      "dynamic_templates": [
        {
          "keyword": {
            "mapping": {
              "index": true,
              "type": "keyword",
              "analyzer": "InsertAnalyzer"
            },
            "match_mapping_type": "keyword"
          }
        }
      ]
    }
  },
  "aliases": {}
}

(James Cullimore) #2

The Error received is

{
  "error": {
    "root_cause": [
      {
        "type": "remote_transport_exception",
        "reason": "[cmiLnYe][<IP-Removed>][indices:admin/template/put]"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "unknown setting [index.analyzer.InsertAnalyzer.filter.0] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
  },
  "status": 400
}

(James Cullimore) #3

I also tried

{
  "order": 0,
  "template": "*",
  "settings": {
    "analysis": {
      "filter": {
        "preserve_original": "true",
        "patterns": [
          "([a-zA-Z]+[-]+[a-zA-Z]+[-]+[0-9a-zA-Z])",
          "([0-9a-zA-Z]+[-]+[0-9a-zA-Z]+)",
          "([0-9a-zA-Z]+[_]+[0-9a-zA-Z]+)",
          "([p{L}d]+)"
        ]
      },
      "ascii_folding": {
        "type": "asciifolding",
        "preserve_original": true
      },
      "analyzer": {
        "InsertAnalyzer": {
          "filter": [
            "lowercase",
            "preserve_original",
            "ascii_folding"
          ],
          "type": "custom",
          "tokenizer": "keyword"
        },
        "SearchAnalyzer": {
          "filter": [
            "lowercase",
            "ascii_folding"
          ],
          "type": "custom",
          "tokenizer": "whitespace"
        }
      }
    }
  },
  "mappings": {
    "cd-db": {
      "properties": {
        "Path": {
          "include_in_all": true,
          "fielddata": true,
          "analyzer": "InsertAnalyzer",
          "type": "text",
          "fields": {
            "keyword": {
              "ignore_above": 1000,
              "boost": 10,
              "type": "keyword"
            }
          }
        },
        "CD-ID": {
          "include_in_all": false,
          "type": "long"
        },
        "Files": {
          "type": "object",
          "properties": {
            "Size": {
              "enabled": false
            },
            "File": {
              "include_in_all": true,
              "fielddata": true,
              "analyzer": "InsertAnalyzer",
              "type": "text",
              "fields": {
                "keyword": {
                  "ignore_above": 1000,
                  "type": "keyword"
                }
              }
            }
          }
        },
        "Date": {
          "include_in_all": false,
          "format": "yyyy-MM-ddHH:mm:ss||yyyy-MM-dd||epoch_millis",
          "type": "date"
        }
      }
    },
    "new_document_service": {
      "properties": {
        "DocumentsSent": {
          "type": "integer"
        },
        "FilesSent": {
          "type": "integer"
        },
        "LastID": {
          "type": "integer"
        },
        "UpdateTime": {
          "include_in_all": true,
          "format": "yyyy-MM-dd@HH:mm:ss||epoch_millis",
          "type": "date"
        }
      }
    },
    "insert_service": {
      "properties": {
        "DocumentsSent": {
          "type": "integer"
        },
        "FilesSent": {
          "type": "integer"
        },
        "LastID": {
          "type": "integer"
        },
        "InsertTime": {
          "include_in_all": true,
          "format": "yyyy-MM-dd@HH:mm:ss||epoch_millis",
          "type": "date"
        }
      }
    },
    "_default_": {
      "dynamic_templates": [
        {
          "keyword": {
            "mapping": {
              "index": true,
              "type": "keyword",
              "analyzer": "InsertAnalyzer"
            },
            "match_mapping_type": "keyword"
          }
        }
      ]
    }
  },
  "aliases": {}
}

and got the following error

{
  "error": {
    "root_cause": [
      {
        "type": "settings_exception",
        "reason": "Failed to get setting group for [index.analysis.filter.] setting prefix and setting [index.analysis.filter.preserve_original] because of a missing '.'"
      }
    ],
    "type": "settings_exception",
    "reason": "Failed to get setting group for [index.analysis.filter.] setting prefix and setting [index.analysis.filter.preserve_original] because of a missing '.'"
  },
  "status": 500
}

I know it's probably a lot to ask, but if someone could point out my mistakes with some explanation, I would be highly appreciative.


(system) #4

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