duanchangnie7996 2019-08-14 08:49
浏览 388

Elasticsearch 6:无法用毫秒解析日期

I'm generating the date via php using the Chronos library. It's using the formatting syntax php uses. Elasticsearch is version 6.2.4. To connect with the ES server I'm using Elastica. I keep getting this error:

failed to parse [created]

when sending this date:

// 2019-08-14 08:40:05.887179
Chronos::now()->format('Y-m-d H:i:s.v');

This is my mapping

"created": {
    "format": "yyyy-MM-dd HH:mm:ss.SSS",
    "type": "date"
},

In the log of the ES server I see this:

java.lang.IllegalStateException: Can't get text on a START_OBJECT at 1:207

If I change the date format to

// 2019-08-14 08:40:05.887179
Chronos::now()->format('Y-m-d H:i:s.u');

I'm getting this error:

java.lang.IllegalArgumentException: Invalid format: "2019-08-14 08:45:35.809896" is malformed at "896"

So how can I get the milliseconds right? :( I don't mind the format as long as I can store the milliseconds somehow.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 使用C#,asp.net读取Excel文件并保存到Oracle数据库
    • ¥15 C# datagridview 单元格显示进度及值
    • ¥15 thinkphp6配合social login单点登录问题
    • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 虚心请教几个问题,小生先有礼了
    • ¥30 截图中的mathematics程序转换成matlab