Kibana date filter Elasticsearch error "failed to parse date field [2023-01-01T00:00:00.000+02:00] with format [dd/MM/yyyy HH:mm:ss Z||epoch_millis]

huangapple go评论66阅读模式
英文:

Kibana date filter Elasticsearch error "failed to parse date field [2023-01-01T00:00:00.000+02:00] with format [dd/MM/yyyy HH:mm:ss Z||epoch_millis]

问题

I have a date field in my Elasticsearch index mapped like:

"updated_at": {
  "format": "dd/MM/yyyy HH:mm:ss Z||epoch_millis",
  "type": "date"
},

The value in the docs _source are epoch millis like "created_at": 1676689641549

If I use the Kibana 7.10 query interface to add a filter like this

Kibana date filter Elasticsearch error "failed to parse date field [2023-01-01T00:00:00.000+02:00] with format [dd/MM/yyyy HH:mm:ss Z||epoch_millis]

This returns the error

"failed to parse date field [2023-01-01T00:00:00.000+01:00] with format [dd/MM/yyyy HH:mm:ss Z||epoch_millis]"

Is there a setting in Kibana 7.10 or in my Elasticsearch mapping that makes the filter UI and the index query play nicely together?

UPDATE 4. Jul 2023: The query generated by Kibana looks like this:

"query": {
  "bool": {
    "must": [],
    "filter": [
      {
        "match_all": {}
      },
      {
        "range": {
          "created_at": {
            "gte": "2022-01-01T00:00:00.000+01:00",
            "lt": "2023-01-01T00:00:00.000+01:00"
          }
        }
      }
    ],
    "should": [],
    "must_not": []
  }
},
英文:

I have a date field in my Elasticsearch index mapped like:

      "updated_at": {
        "format" : "dd/MM/yyyy HH:mm:ss Z||epoch_millis",
        "type": "date"
      },

The value in the docs _source are epoch millis like "created_at": 1676689641549

If I use the Kibana 7.10 query interface to add a filter like this

Kibana date filter Elasticsearch error "failed to parse date field [2023-01-01T00:00:00.000+02:00] with format [dd/MM/yyyy HH:mm:ss Z||epoch_millis]

This returns the error

> "failed to parse date field [2023-01-01T00:00:00.000+01:00] with format [dd/MM/yyyy HH:mm:ss Z||epoch_millis]"

Is there a setting in Kibana 7.10 or in my Elasticsearch mapping that makes the filter UI and the index query play nicely together?

NOTES:

UPDATE 4. Jul 2023: The query generated by Kibana looks like this:

"query": {
    "bool": {
      "must": [],
      "filter": [
        {
          "match_all": {}
        },
        {
          "range": {
            "created_at": {
              "gte": "2022-01-01T00:00:00.000+01:00",
              "lt": "2023-01-01T00:00:00.000+01:00"
            }
          }
        }
      ],
      "should": [],
      "must_not": []
    }
  },

答案1

得分: 1

这只是在我更新映射并重新索引时才有效:

"created_at": {
  "type": "date",
  "format": "date_time||epoch_millis"
},

感谢 @val 的建议!

英文:

This just worked when I updated the mappings and reindexed with:

          "created_at": {
            "type": "date",
            "format": "date_time||epoch_millis"
          },

Thanks @val for the suggestion!

huangapple
  • 本文由 发表于 2023年6月21日 23:36:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/76524992.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定