opendatasoft / elasticsearch-aggregation-pathhierarchy

An elasticsearch plugin to create hierarchical aggregations
MIT License
51 stars 12 forks source link

Current context not Array but Object #7

Closed kedjeha closed 5 years ago

kedjeha commented 5 years ago

Hi,

I am using the plugin v6.6.0.0 with elasticsearch v6.6.0. For example , a query with this body work well : { "aggs": { "tree": { "path_hierarchy": { "field": "path", "separator": "/" } } } } But when i set the size > 10, I get an error 500 { "error": { "root_cause": [ { "type": "json_generation_exception", "reason": "Current context not Array but Object" } ], "type": "json_generation_exception", "reason": "Current context not Array but Object" }, "status": 500 } The complete log is com.fasterxml.jackson.core.JsonGenerationException: Current context not Array but Object at com.fasterxml.jackson.core.JsonGenerator._reportError(JsonGenerator.java:1897) ~[jackson-core-2.8.11.jar:2.8.11] at com.fasterxml.jackson.core.json.UTF8JsonGenerator.writeEndArray(UTF8JsonGenerator.java:297) ~[jackson-core-2.8.11.jar:2.8.11] at org.elasticsearch.common.xcontent.json.JsonXContentGenerator.writeEndArray(JsonXContentGenerator.java:178) ~[elasticsearch-x-content-6.6.0.jar:6.6.0] at org.elasticsearch.common.xcontent.XContentBuilder.endArray(XContentBuilder.java:278) ~[elasticsearch-x-content-6.6.0.jar:6.6.0] at org.opendatasoft.elasticsearch.search.aggregations.bucket.InternalPathHierarchy.doXContentBody(InternalPathHierarchy.java:319) ~[?:?] at org.elasticsearch.search.aggregations.InternalAggregation.toXContent(InternalAggregation.java:212) ~[elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.search.aggregations.Aggregations.toXContentInternal(Aggregations.java:129) ~[elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.search.aggregations.Aggregations.toXContent(Aggregations.java:120) ~[elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.action.search.SearchResponseSections.toXContent(SearchResponseSections.java:108) ~[elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.action.search.SearchResponse.innerToXContent(SearchResponse.java:241) ~[elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.action.search.SearchResponse.toXContent(SearchResponse.java:221) ~[elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.rest.action.RestStatusToXContentListener.buildResponse(RestStatusToXContentListener.java:57) ~[elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.rest.action.RestStatusToXContentListener.buildResponse(RestStatusToXContentListener.java:33) ~[elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.rest.action.RestToXContentListener.buildResponse(RestToXContentListener.java:42) ~[elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.rest.action.RestToXContentListener.buildResponse(RestToXContentListener.java:34) ~[elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.rest.action.RestResponseListener.processResponse(RestResponseListener.java:37) ~[elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.rest.action.RestActionListener.onResponse(RestActionListener.java:47) ~[elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.action.support.TransportAction$1.onResponse(TransportAction.java:85) ~[elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.action.support.TransportAction$1.onResponse(TransportAction.java:81) ~[elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.action.search.AbstractSearchAsyncAction.onResponse(AbstractSearchAsyncAction.java:313) ~[elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.action.search.AbstractSearchAsyncAction.onResponse(AbstractSearchAsyncAction.java:50) ~[elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.action.search.FetchSearchPhase$3.run(FetchSearchPhase.java:213) ~[elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.action.search.AbstractSearchAsyncAction.executePhase(AbstractSearchAsyncAction.java:160) ~[elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.action.search.AbstractSearchAsyncAction.executeNextPhase(AbstractSearchAsyncAction.java:153) ~[elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.action.search.ExpandSearchPhase.run(ExpandSearchPhase.java:120) ~[elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.action.search.AbstractSearchAsyncAction.executePhase(AbstractSearchAsyncAction.java:160) ~[elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.action.search.AbstractSearchAsyncAction.executeNextPhase(AbstractSearchAsyncAction.java:153) ~[elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.action.search.FetchSearchPhase.moveToNextPhase(FetchSearchPhase.java:206) ~[elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.action.search.FetchSearchPhase.lambda$innerRun$2(FetchSearchPhase.java:104) ~[elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.action.search.FetchSearchPhase.innerRun(FetchSearchPhase.java:118) [elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.action.search.FetchSearchPhase.access$000(FetchSearchPhase.java:44) [elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.action.search.FetchSearchPhase$1.doRun(FetchSearchPhase.java:86) [elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:759) [elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:41) [elasticsearch-6.6.0.jar:6.6.0] at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.6.0.jar:6.6.0] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_144] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_144] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_144]

Could somebody help? thanks.

5k4nd commented 5 years ago

Hi, I can't reproduce on my side without more context, could you please give us some pieces of information about your current configuration? e.g. index mapping, sample of indexed documents. Thanks

kedjeha commented 5 years ago

Hi Here are the additional informations :

Mapping:

{ "mappings": { "article": { "properties": { "artId": {"type": "long"}, "title": { "type": "text" }, "content": { "type": "text" }, "path": { "type": "keyword" }, "category1": { "type": "keyword" }, "category2": { "type": "keyword" }, "category3": { "type": "keyword" }, "category4": { "type": "keyword" }, "category5": { "type": "keyword" }, "category6": { "type": "keyword" }, "category7": { "type": "keyword" }, "category8": { "type": "keyword" }, "category9": { "type": "keyword" }, "category10": { "type": "keyword" }, "category11": { "type": "keyword" }, "category12": { "type": "keyword" }, "category13": { "type": "keyword" }, } } } }

sample of indexed documents :

{ "category2": 6, "category3": 62, "category4": 11, "category_en": "Nikan Taxation > Legislation > 2017 > Tax Code > First Book - Income Taxes > Part I - Income Taxes > Title I - Taxes On Profits > Chapter I > Section I - Taxable Enterprises [Art. 1 - 3] > ", "code": "CGI2017_1", "category5": 63, "category_fr": "1. NIKAN FISCALITE > LEGISLATION > 2017 > CODE GENERAL DES IMPÔTS > Livre premier - Impots sur les revenus > Premiere Partie - Impots sur les revenus > Titre premier - Impots sur les benefices > Chapitre I > Section I - Entreprises Imposables [Art. 1 - 3] > ", "category1": 1, "artId": 1, "content": "Art 1- \r\nIt is established that an annual tax on the profits of the commercial, industrial, craft occupations, the forestry or agricultural developments and the mining companies, on the profits pulled from the activities of search, from exploitation, from production and from sale of hydrocarbons natural, including the operations of transport in Ivory Coast which are the accessory. \r\n\r\n<br><i>Ord. N 70-501 of August 12th, 1970. Art. 7-1; law N 94-201 of April 8th, 1994, the year. Fiscal, art. 8.</i>", "category6": 770, "category7": 64, "category8": 65, "category9": 66, "path": "/1/6/62/11/63/770/64/65/66", "title": "Article 1 CGI 2017", }

I have indexed more than 4000 documents.

Thanks.

5k4nd commented 5 years ago

@kedjeha it should be resolved now, let us know if not!

kedjeha commented 5 years ago

Thanks. It is working fine!