Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Histogram Agg result fails to generate XContent #11692

Closed
s1monw opened this issue Jun 16, 2015 · 1 comment · Fixed by #11482
Closed

Histogram Agg result fails to generate XContent #11692

s1monw opened this issue Jun 16, 2015 · 1 comment · Fixed by #11482
Assignees

Comments

@s1monw
Copy link
Contributor

s1monw commented Jun 16, 2015

I have a simple testcase here:

@Test
    public void testExecute_withAggs() throws Exception {

        client().admin().indices().prepareCreate("my-index")
                .addMapping("my-type", "_timestamp", "enabled=true")
                .get();
        ensureGreen("my-index");

        client().prepareIndex("my-index", "my-type").setTimestamp("2005-01-01T00:00").setSource("{}").get();
        client().prepareIndex("my-index", "my-type").setTimestamp("2005-01-01T00:10").setSource("{}").get();
        client().prepareIndex("my-index", "my-type").setTimestamp("2005-01-01T00:20").setSource("{}").get();
        client().prepareIndex("my-index", "my-type").setTimestamp("2005-01-01T00:30").setSource("{}").get();
        refresh();

        SearchResponse response = client().prepareSearch("my-index")
                .addAggregation(AggregationBuilders.dateHistogram("rate").field("_timestamp").interval(DateHistogramInterval.HOUR).order(Histogram.Order.COUNT_DESC))
                .get();
        response.toString();
    }

which fails generating the XContent with this:


java.lang.UnsupportedOperationException: Printing not supported
    at __randomizedtesting.SeedInfo.seed([4C10016566504505:7B5D40D0D89482B4]:0)
    at org.joda.time.format.DateTimeFormatter.requirePrinter(DateTimeFormatter.java:695)
    at org.joda.time.format.DateTimeFormatter.print(DateTimeFormatter.java:642)
    at org.elasticsearch.search.aggregations.support.format.ValueFormatter$DateTime.format(ValueFormatter.java:127)
    at org.elasticsearch.search.aggregations.bucket.histogram.InternalHistogram$Bucket.toXContent(InternalHistogram.java:156)
    at org.elasticsearch.search.aggregations.bucket.histogram.InternalHistogram.doXContentBody(InternalHistogram.java:535)
    at org.elasticsearch.search.aggregations.InternalAggregation.toXContent(InternalAggregation.java:202)
    at org.elasticsearch.search.aggregations.InternalAggregations.toXContentInternal(InternalAggregations.java:196)
    at org.elasticsearch.search.aggregations.InternalAggregations.toXContent(InternalAggregations.java:187)
    at org.elasticsearch.search.internal.InternalSearchResponse.toXContent(InternalSearchResponse.java:91)
    at org.elasticsearch.action.search.SearchResponse.toXContent(SearchResponse.java:181)
    at org.elasticsearch.action.search.SearchResponse.toString(SearchResponse.java:225)
    at org.elasticsearch.search.aggregations.bucket.HistogramTests.testExecute_withAggs(HistogramTests.java:1041)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

to me this looks wrong :) but not my part of the system to figure out what the hack is going on... @colings86 maybe?

happens only on 2.0

@jpountz
Copy link
Contributor

jpountz commented Jun 16, 2015

This bug will be fixed with #11482 which adds a printer to the epoch_second and epoch_millis formats. I pushed the test case suggested in this issue to master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants