es to solve the wrong type for mapping Date

Online encounter a problem, reptile Published data taken is the time stamp, date to be converted, but some data is dirty data, converted into a date might look like " 001-10-1 " does not look consistent with the date format, However, the data is written es will report an error 

failed to parse field [approval_time] of type [date]

No way this field can only change what type of modification to text mapping will approval_time 

{
  "mappings": {
    "important_invest": {
      "properties": {
        "approval_time": {
          "type": "text"
        }
      }
    }
  }
}

Thinking that it can be solved, in kibana is also possible to visit, but there is a problem in java, throw an error:

Fielddata is disabled on text fields by default. Set fielddata=true on [approval_time] 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.

By default, the text field is disabled Fielddata. Fielddata = true is provided in [approval_time], to load fielddata in memory by reversing the inverted index. Note that this may consume large amounts of memory. Or use the keyword field.

Well this problem need to add fielddata = true    everything is all right platform data finally show

{
  "mappings": {
    "important_invest": {
      "properties": {
        "approval_time": {
          "type": "text",
          "fielddata": true
        }
      }
    }
  }
}

Search to the information but did not try:

elasticsearch default automatically identify the type of date, if you want to turn off this feature, the modification mapping settings 'date_detection' => false to.

发布了131 篇原创文章 · 获赞 7 · 访问量 3万+

Guess you like

Origin blog.csdn.net/weixin_43064185/article/details/103587054
Recommended