1w means one week, 12.3d means 12.3 days, 52w means 52 weeks, 4h means 4 hours, 12.3ms means 12.3 milliseconds, 12 means 12 milliseconds but without the suffix the value must be an integer.
In other words, TimeValue supports the parsing of a String that contains a long integer digit string to mean milliseconds, or an integer or floating point digit string with a suffix. So a WEEK is represented as "1w" or "7d", and an HOUR is represented as "1h" or "60m". So if you want to support your own vocabulary, then create a wrapper class that converts your own terms to TimeValue strings, then then passes them into the TimeValue class. Brian On Tuesday, June 17, 2014 11:31:37 AM UTC-4, Thomas wrote: > > Hi, > > I was wondering whether there is a proper Utility class to parse the given > values and get the duration in milliseconds probably for values such as 1m > (which means 1 minute) 1q (which means 1 quarter) etc. > > I have found that elasticsearch utilizes class TimeValue but it only > parses up to week, and values such as WEEK, HOUR are not accepted. So is in > elasticsearch source any utility class that does the job ? (for Histograms, > ranges wherever is needed) > > Thank you > Thomas > > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/3078016f-fe47-468b-a36f-c19f2a5c607d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.