I'm trying to work with dates inside a script. I've got a few questions:
1. How do I reference a script that I have in the scripts directory? Simply
POSTing to /index/type/id/_update with { "script": "scriptname" } does not seem
to work. "No such property: scriptname for class: ScriptN", where N starts at 3
(I have two .groovy files in my scripts directory).
2: How can I get actual date objects from the source? ctx._source.fieldname
always returns a type string, even if I just created the field with
ctx._source.fieldname = new Date(). Right now I'm parsing the string output in
Groovy, which seems suboptimal.
3: Are ISO8601 dates not fully supported, as far as arbitrary fractional second
decimals? (Not just 3 or another fixed number?) Any suggestions on handling
JSON input from multiple sources, some of which have high-precision?
4: Can I use a script to project the document into a scalar for aggregates? For
instance, if I have Date fields "start" and "end", and want to calculate the
average duration (start - end) in an aggregate. I see value-level scripts are
allowed, and 1.4 has "scripted metric aggregation". For now am I best off just
storing the duration in the document?
Thank you,
Michael
--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/13d4cf783a83447a84b62206605ad312%40CO1PR07MB331.namprd07.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.