Java API Error on Aggregations


(William Bowen) #1

Hello, I'm using the Java API (1.4.5) to submit JSON like so:

SearchResponse response = client.prepareSearch(index).setSource(json).get();

Where json is a Map that's being passed to me. Suffice to say, I'm being passed this map and cannot use the builders (without basically deconstructing the map). When I POST the JSON string created from the map to port 9200 in Postman, it comes back fine. However submitting over the transport client through the API I get:

org.elasticsearch.ElasticsearchIllegalStateException: show_terms_doc_count_error is false
	at org.elasticsearch.search.aggregations.bucket.terms.InternalTerms$Bucket.getDocCountError(InternalTerms.java:66)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:654)
	at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:675)
	... 68 more

Suffice to say, I've found that it comes down to the aggregations. When I remove them from the JSON, it works. But any of the aggs are causing it. Here's an example:

"aggs": {
        "types_count": {
            "terms": {
                "field": "kind",
                "order": {
                    "_term": "asc"
                }
            }
        }
    }

Has anyone seen anything like this? I've never seen the issue with simple aggregations and searches yielded no results on the subject.

Thanks in advance!


(yejinbiao) #2

i met the problem too,have you ever found a way to solve it ?


(system) #3