Hi All,
I like to create a facet list like:
- this week
- last month
- last quarter
- last year
- older
I have a dataset with an adddate field. The adddate in milliseconds minus
the current date/time in millisecons gives me an amount of milliseconds
which I could use to create the facet. Within the range facet the amount of
milliseconds for the several, before, mentioned cases are definied:
"facets" : {
"test" : {
"range" : {
"key_script" : "doc['adddate'].date.getMillis - System.currentTimeInMillis",
"value_script" : "1",
"ranges" : [
{ "from" : "0", "to" : "604800000" },
{ "from" : "604800001", "to" : "2678400000" },
{ "from" : "2678400001", "to" : "2678400000" },
{ "from" : "2678400001", "to" : "7776000000" },
{ "from" : "7776000001", "to" : "31536000000" },
{ "from" : "31536000001" }
]
}
}
}
However..... it fails with the script:
PropertyAccessException[[Error: could not access: getMillis; in class:
org.elasticsearch.common.joda.time.MutableDateTime] [Near : {...
doc['adddate'].date.getMillis ....}]
Are not all methods and properties of the Joda MutableDateTime exposed and
if not..... is there another solution to get the above result. Is I only
try the System.currentTimeInMillis, it fails as well.
Thanks in advance
BTW I'm using ES 0.90.0 Beta
--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.