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

RestHighLevelClient throws exception parsing RareTerms aggregation results #63025

Closed
ajeydudhe opened this issue Sep 29, 2020 · 2 comments
Closed
Labels
>bug Team:Data Management Meta label for data/management team

Comments

@ajeydudhe
Copy link

Elasticsearch version (bin/elasticsearch --version): 7.9.2

Plugins installed: []

JVM version (java -version):
java version "1.8.0_251"
Java(TM) SE Runtime Environment (build 1.8.0_251-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.251-b08, mixed mode)

OS version (uname -a if on a Unix-like system):
Darwin Ajeys-MacBook-Pro.local 19.6.0 Darwin Kernel Version 19.6.0: Thu Jun 18 20:49:00 PDT 2020; root:xnu-6153.141.1~1/RELEASE_X86_64 x86_64

Description of the problem including expected versus actual behavior:
Performing the RareTerms aggregation using the RestHighLevelClient. The request seems to execute on server side and results are also returned. From the exception stack it looks like the client is not able to parse the RareTerms aggregation result. Also, the AggregationBuilders does not have the helper method for RareTerms aggregation so creating the instance directly. Note that other searches or aggregations work as expected.

Steps to reproduce:
The search request is created as follllows

final SearchSourceBuilder searchBuilder = new SearchSourceBuilder();
searchBuilder.aggregation(new RareTermsAggregationBuilder("rare_terms_aggs").field("some.field").maxDocCount(5));

Provide logs (if relevant):

java.io.IOException: Unable to parse response body for Response{requestLine=POST /businesses/_search?typed_keys=true&max_concurrent_shard_requests=5&ignore_unavailable=false&expand_wildcards=open&allow_no_indices=true&ignore_throttled=true&search_type=query_then_fetch&batched_reduce_size=512&ccs_minimize_roundtrips=true HTTP/1.1, host=http://localhost:9200, response=HTTP/1.1 200 OK}
        at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1632)
        at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1583)
        at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1553)
        at org.elasticsearch.client.RestHighLevelClient.search(RestHighLevelClient.java:1069)
        at my.code.search.ElasticsearchClient.invoke(ElasticsearchClient.java:105)
        at my.code.search.ElasticsearchClient.search(ElasticsearchClient.java:52)
        at my.code.search.SearchHandler.getBusinessCountByCity(SearchHandler.java:253)
        at my.code.search.SearchIT.testBusinessCountByCity_noRecordsForCitiesWithLessThan5Businesses(SearchIT.java:319)
        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:498)
        at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
        at org.testng.internal.Invoker.invokeMethod(Invoker.java:583)
        at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719)
        at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:989)
        at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
        at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
        at org.testng.TestRunner.privateRun(TestRunner.java:648)
        at org.testng.TestRunner.run(TestRunner.java:505)
        at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
        at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
        at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
        at org.testng.SuiteRunner.run(SuiteRunner.java:364)
        at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
        at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
        at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)
        at org.testng.TestNG.runSuitesLocally(TestNG.java:1137)
        at org.testng.TestNG.runSuites(TestNG.java:1049)
        at org.testng.TestNG.run(TestNG.java:1017)
        at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:135)
        at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeSingleClass(TestNGDirectoryTestSuite.java:112)
        at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:99)
        at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:146)
        at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
        at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
Caused by: org.elasticsearch.common.xcontent.NamedObjectNotFoundException: [1:208] unknown field [srareterms]
        at org.elasticsearch.common.xcontent.NamedXContentRegistry.parseNamedObject(NamedXContentRegistry.java:132)
        at org.elasticsearch.common.xcontent.support.AbstractXContentParser.namedObject(AbstractXContentParser.java:385)
        at org.elasticsearch.common.xcontent.XContentParserUtils.parseTypedKeysObject(XContentParserUtils.java:153)
        at org.elasticsearch.search.aggregations.Aggregations.fromXContent(Aggregations.java:142)
        at org.elasticsearch.action.search.SearchResponse.innerFromXContent(SearchResponse.java:306)
        at org.elasticsearch.action.search.SearchResponse.fromXContent(SearchResponse.java:265)
        at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:1892)
        at org.elasticsearch.client.RestHighLevelClient.lambda$performRequestAndParseEntity$8(RestHighLevelClient.java:1554)
        at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1630)
        ... 37 common frames omitted
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features (:Core/Features/Java High Level REST Client)

@elasticmachine elasticmachine added the Team:Data Management Meta label for data/management team label Oct 2, 2020
@danielmitterdorfer danielmitterdorfer removed the needs:triage Requires assignment of a team area label label Oct 13, 2020
@swallez
Copy link
Member

swallez commented Nov 17, 2020

Should be fixed by PR #64454 and its backports to 7.x and 7.10

@swallez swallez closed this as completed Nov 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug Team:Data Management Meta label for data/management team
Projects
None yet
Development

No branches or pull requests

5 participants