2015-11-19 76 views
1

我想使用ElasticSearch中的strict_date格式化程序,它是一个格式化程序的完整日期为四位数年份,一年两位数月份和两位数月份日期:yyyy-MM- DD。ElasticSearch日期格式,使用严格的错误

我使用以下代码奇迹:

PUT my_strictindex 
{ 
    "mappings": { 
    "my_type": { 
     "properties": { 
     "dob": { 
      "type": "strict_date" 
     } 
     } 
    } 
    } 
} 

我得到以下错误:

{ “错误”:“MapperParsingException [映射[my_type]];嵌套:MapperParsingException [否在字段[dob]]上声明类型[strict_date]的处理程序;“, ”status“:400 }

任何帮助将不胜感激!

回答

1

参考ES Docs

应该

{ 
    "mappings": { 
    "my_type": { 
     "properties": { 
     "dob": { 
      "type": "date", 
      "format": "strict_date" 
     } 
     } 
    } 
    } 
} 
+0

是的,我已经提到,包括您发布的代码,但我将如何去有关将strict_date它的文档? @ ChintanShah25 – emarel

+0

我编辑了我的答案,你正在使用什么版本的ES? – ChintanShah25

+0

不幸的是,这仍然不适合我。我运行v 1.6.2 ..这可能是原因吗? – emarel