Skip to content

Conversation

@cbuescher
Copy link
Member

I just tried to access the millis of a date field in painless and tried to use "getMillis" on the document value like doc['event_date'].value.getMillis because that is how I read the documentation. It turns out the way it works is doc['event_date'].value.millis. I might be missing something, but if not I think the docs are a bit misleading and could be corrected like suggested.

I just tried to access the millis of a date field in painless and tried to use "getMillis" on the document value like `doc['event_date'].value.getMillis` because that is how I read the documentation. It turns out the way it works is `doc['event_date'].value.millis`. I might be missing something, but if not I think the docs are a bit misleading and could be corrected like suggested.
@cbuescher cbuescher added >docs General docs changes :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache v7.0.0 v6.5.0 labels Sep 10, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@cbuescher cbuescher requested a review from jdconrad September 18, 2018 14:14
@cbuescher
Copy link
Member Author

cbuescher commented Sep 18, 2018

@jdconrad does the above make sense to you, if so, do you agree with the proposed changed? Maybe I just misses something obvious though. Thanks!

Copy link
Contributor

@jdconrad jdconrad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cbuescher Sorry, I missed this earlier. This looks great, and I'm sure the change will be appreciated among users as dates are difficult enough as they are.

@cbuescher cbuescher merged commit 6f3b333 into master Sep 19, 2018
@cbuescher
Copy link
Member Author

@jdconrad thanks for the review

cbuescher pushed a commit that referenced this pull request Sep 19, 2018
The documentation currently tells users to use `doc['event_date'].value.getMillis` to access
milliseconds in a date. It turns out the way it works is `doc['event_date'].value.millis`. This 
change corrects this and gives a hint at how other date related methods work.
cbuescher pushed a commit that referenced this pull request Sep 19, 2018
The documentation currently tells users to use `doc['event_date'].value.getMillis` to access
milliseconds in a date. It turns out the way it works is `doc['event_date'].value.millis`. This
change corrects this and gives a hint at how other date related methods work.
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Sep 19, 2018
* master: (46 commits)
  Fixing assertions in integration test (elastic#33833)
  [CCR] Rename idle_shard_retry_delay to poll_timout in auto follow patterns (elastic#33821)
  HLRC: Delete ML calendar (elastic#33775)
  Move DocsStats into Engine (elastic#33835)
  [Docs] Clarify accessing Date methods in painless (elastic#33560)
  add elasticsearch-shard tool (elastic#32281)
  Cut over to unwrap segment reader (elastic#33843)
  SQL: Fix issue with options for QUERY() and MATCH(). (elastic#33828)
  Emphasize that filesystem-level backups don't work (elastic#33102)
  Use the global doc id to generate a random score (elastic#33599)
  Add minimal sanity checks to custom/scripted similarities. (elastic#33564)
  Profiler: Don’t profile NEXTDOC for ConstantScoreQuery. (elastic#33196)
  [CCR] Change FollowIndexAction.Request class to be more user friendly (elastic#33810)
  SQL: day and month name functions tests locale providers enforcement (elastic#33653)
  TESTS: Set SO_LINGER = 0 for MockNioTransport (elastic#32560)
  Test: Relax jarhell gradle test (elastic#33787)
  [CCR] Fail with a descriptive error if leader index does not exist (elastic#33797)
  Add ES version 6.4.2 (elastic#33831)
  MINOR: Remove Some Dead Code in Scripting (elastic#33800)
  Ensure realtime `_get` and `_termvectors` don't run on the network thread (elastic#33814)
  ...
@cbuescher cbuescher deleted the painless-docs-dateaccess branch May 13, 2020 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Core/Infra/Scripting Scripting abstractions, Painless, and Mustache >docs General docs changes v6.4.2 v6.5.0 v7.0.0-beta1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants