-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Index name expression resolver bwc layer for date parsing #58503
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
Merged
pgomulka
merged 15 commits into
elastic:6.8
from
pgomulka:bp/index_name_expression_resolver
Jul 2, 2020
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d2a1aff
backport index name resolver
pgomulka 1eb41c8
fix geting local date from week based date
pgomulka d12a209
checkstyle
pgomulka 662d3ac
Revert "GlobalBuildInfo support packed-refs with work-tree (#50791)"
pgomulka eccb89d
fix millis parsing
pgomulka 9febfc8
Revert "Revert "GlobalBuildInfo support packed-refs with work-tree (#…
pgomulka 73b9e08
draft test
pgomulka c120884
joda and java yml test
pgomulka 4eed78b
remove unused test
pgomulka e7f1ba2
add index and search test case
pgomulka e773628
code review fixes
pgomulka ed9e8c6
fix formatter creation
pgomulka de1067a
add back dmath expresion resolver to a list
pgomulka 31e8cfe
Merge branch '6.8' into bp/index_name_expression_resolver
pgomulka 0a89df0
import
pgomulka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
rest-api-spec/src/main/resources/rest-api-spec/test/index/81_week_based_java_date.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| --- | ||
| "Index java 8 date without timezone": | ||
|
|
||
| - skip: | ||
| version: " - 6.7.99" | ||
| reason: fixed in 6.8.11 | ||
|
|
||
| - do: | ||
| indices.create: | ||
| index: test_index | ||
| body: | ||
| settings: | ||
| number_of_shards: 1 | ||
| mappings: | ||
| doc: | ||
| properties: | ||
| date_field: | ||
| type: date | ||
| format: "8YYYY-ww" | ||
| - do: | ||
| bulk: | ||
| refresh: true | ||
| body: | ||
| - '{"index": {"_index": "test_index", "_type": "doc", "_id": "1"}}' | ||
| - '{"date_field": "2020-32"}' | ||
| - '{"index": {"_index": "test_index", "_type": "doc", "_id": "2"}}' | ||
| - '{"date_field": "2020-33"}' | ||
|
|
||
| - match: { errors: false } | ||
|
|
||
| - do: | ||
| get: | ||
| index: test_index | ||
| type: doc | ||
| id: 2 | ||
|
|
||
| - match: { _index: test_index } | ||
| - match: { _type: doc } | ||
| - match: { _id: "2"} | ||
| - match: { _version: 1} | ||
| - match: { _source: { "date_field": "2020-33" }} | ||
|
|
||
| - do: | ||
| search: | ||
| index: test_index | ||
| body: { "query": { "range": { "date_field": { "gte": "2020-33" } } } } | ||
|
|
||
| - match: {hits.total: 1 } | ||
| - match: {hits.hits.0._index: test_index } | ||
| - match: {hits.hits.0._type: doc } | ||
| - match: {hits.hits.0._source.date_field: "2020-33" } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We previously added the '8' prefix in date formats so that both joda and java formats could be distinguished. I have a vague memory that the zone identifiers do not completely match up between joda and java. Is this correct? If so, what happens if the format specified by the user is one not supported by java?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we test against this discrepancies in https://github.com/elastic/elasticsearch/blob/6.8/server/src/test/java/org/elasticsearch/common/time/DateUtilsTests.java#L38
as long as timezone dbs are the same in both joda and java (and we make sure about this with this test) then there should always be a match