Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date format inconsistent between the Fields API and search_after #68988

Closed
majagrubic opened this issue Feb 15, 2021 · 3 comments
Closed

Date format inconsistent between the Fields API and search_after #68988

majagrubic opened this issue Feb 15, 2021 · 3 comments
Labels
:Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch

Comments

@majagrubic
Copy link

majagrubic commented Feb 15, 2021

When discussing #67063 and its effects on the usage of the Fields API in Discover, we had agreed with Nik to explicitly request the date format with each date field.

This works fine for date_nanos mapping, but for date_nanos mapping with a custom date format, there seems to be an issue when passing the same date back in search_after. It looks like the same format is not accepted in search_after.

Eg:
For the mapping: https://github.com/elastic/kibana/blob/c42d23347a901ae7b7af5855eaddc8c2972762cc/test/functional/fixtures/es_archiver/date_nanos_custom/mappings.json#L18

If we read the date from the fields section when displaying the context view, we use the search_after in the query. The exception we get in this case is:

"statusCode":400,"attributes":{"root_cause":[{"type":"parse_exception","reason":"failed to parse date field [2019-10-21T08:30:04.828733Z] with format [yyyy-MM-dd HH:mm:ss.SSSSSS]

Specifying a format is one thing, but Kibana should not be doing a "normalization" of dates between taking an ES response and providing its values back to ES.

@majagrubic majagrubic added >bug needs:triage Requires assignment of a team area label labels Feb 15, 2021
@majagrubic majagrubic changed the title Date format inconsistent in the Fields API Date format inconsistent between the Fields API and search_after Feb 15, 2021
@dnhatn dnhatn added :Search Foundations/Mapping Index mappings, including merging and defining field types and removed >bug needs:triage Requires assignment of a team area label labels Feb 15, 2021
@elasticmachine elasticmachine added the Team:Search Meta label for search team label Feb 15, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

@dnhatn
Copy link
Member

dnhatn commented Feb 15, 2021

Relates #67063

@jimczi
Copy link
Contributor

jimczi commented Feb 15, 2021

The exception you're getting is expected. The format yyyy-MM-dd HH:mm:ss.SSSSSS cannot parse 2019-10-21T08:30:04.828733Z. If you want to parse with optional T, you should use strict_date_optional_time_nanos.
I tested the same example with search_after and the fields option and it worked fine with strict_date_optional_time_nanos so I hope you don't mind if I close this issue.

@jimczi jimczi closed this as completed Feb 15, 2021
@javanna javanna added Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch and removed Team:Search Meta label for search team labels Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch
Projects
None yet
Development

No branches or pull requests

5 participants