Things to change in elastic java high level client code for moving from joda to java time

what are the things to change in elastic java high-level client code for moving from joda to java time ?

my current code is as below. I am using 6.8.3 elk version

I need to change code, so I can use it in elk 7.4

     TimeZone timezoneID = TimeZone.getTimeZone("America/chicago");

     SearchResponse response = hclient.search(new SearchRequest("metricbeat*")
                    .source(

                            new SearchSourceBuilder()

                                    .aggregation(
                                            AggregationBuilders.dateHistogram("mainAgg")
                                                    .field("@timestamp")    
                                                    .dateHistogramInterval("1d")     
                                                    .format("dd/MM/YYYY")  
                                                    .timeZone(DateTimeZone.forTimeZone(timezoneID))
                                                    .minDocCount(0)
                                                    .order(BucketOrder.key(false))

                                    )
                                    .size(0)
                    ), RequestOptions.DEFAULT);

Hey,

you need to replace the timeZone with a java based timezone, i.e. by calling ZoneId.of or ZoneOffset.of - the good thing with java will be that this will be a compilation error, so you can spot it early.

--Alex

Thanks sir

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.