elasticsearch,Php,elasticsearch" /> elasticsearch,Php,elasticsearch" />

Php Elasticsearch日期格式映射

Php Elasticsearch日期格式映射,php,elasticsearch,Php,elasticsearch,因此,我想在elasticsearch中导入以下日期格式作为日期字段: 2015-01-12T03:00:00 不幸的是,elasticsearch无法通过以下映射识别此格式: { "mappings": { "veenendaal_type_new": { "properties": { "1061_Mundo_Sport_Veenendaal": { "type": "integer" },

因此,我想在elasticsearch中导入以下日期格式作为日期字段:

2015-01-12T03:00:00
不幸的是,elasticsearch无法通过以下映射识别此格式:

{
    "mappings": {
      "veenendaal_type_new": {
        "properties": {
          "1061_Mundo_Sport_Veenendaal": {
            "type": "integer"
          },
          "1076_We_Veenendaal_Bernard_van_Kreelpoort": {
            "type": "integer"
          },
          "1103_V&D_Veenendaal": {
            "type": "integer"
          },
          "1167_Action_Veenendaal": {
            "type": "integer"
          },
          "1171_Speksnijder_Veenendaal": {
            "type": "integer"
          },
          "1178_Ingang_Corridor_t_h_v__C&A_Veenendaal": {
            "type": "integer"
          },
          "1181_Ingang_Corridor_t_h_v__Bart_Smit_Veenendaal": {
            "type": "integer"
          },
          "1183_De_Heren_van_XVII_Veenendaal": {
            "type": "integer"
          },
          "1184_Corridor_t_h_v__CandyShop_Veenendaal": {
            "type": "integer"
          },
          "1186_Corridor_t_h_v__Het_Goudhaantje_Veenendaal": {
            "type": "integer"
          },
          "1188_Takko_Veenendaal": {
            "type": "integer"
          },
          "1212_De_Cultuurfabriek_Veenendaal": {
            "type": "integer"
          },
          "1216_Jac_Hensen_Veenendaal": {
            "type": "integer"
          },
          "1505_Floral_Haircare_Veenendaal": {
            "type": "integer"
          },
          "201_WE_Veenendaal": {
            "type": "integer"
          },
          "940_HEMA_Veenendaal": {
            "type": "integer"
          },
          "Tijdsperiode": {
            "type": "date"
          }
        }
      }
    }
  }  
Elasticsearch返回此错误:

MapperParsingException[failed to parse [Tijdsperiode]]; nested: IllegalArgumentException[Invalid format: "2015-01-12T03:00:00" is malformed at "T03:00:00"];

我的问题是,如何使此格式(2015-01-12T03:00:00)对elasticsearch有效

在索引定义中使用此选项:


“Tijdsperiode”:{
“类型”:“日期”,
格式:“yyyy-MM-dd'T'HH:MM:ssZ”
}

或许

“格式”:“日期时间号”


在索引定义中使用此选项:


“Tijdsperiode”:{
“类型”:“日期”,
格式:“yyyy-MM-dd'T'HH:MM:ssZ”
}

或许

“格式”:“日期时间号”

在php中,如下所示:

date("c", $date_string);//ISO 8601 2004-02-12T15:19:21+00:00
在php中,如下所示:

date("c", $date_string);//ISO 8601 2004-02-12T15:19:21+00:00

Tijdsperiode
字段的映射中有一个悬空的逗号,这使得它无效。您是如何安装此映射的?能否运行
curl-XGET localhost:9200/您的_索引
?在
Tijdsperiode
字段的映射中有一个悬空的逗号,这使得它无效。您是如何安装此映射的?你能运行
curl-XGET localhost:9200/你的索引吗?
index:not_analysis
仅用于字符串类型,不需要用于日期类型。因此我更改答案
“Tijdsperiode”:{“type”:“date”,“format”:“yyyy-MM-dd'T'HH:MM:ssZ”
索引:not_analysis
仅用于字符串类型,日期类型不需要。因此我更改了答案
“Tijdsperiode”:{“type”:“date”,“format”:“yyy-MM-dd'HH:MM:ssZ”}