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

Java High Level Rest Client cannot parse weighted_avg result #36861

Closed
xpando opened this issue Dec 19, 2018 · 8 comments
Closed

Java High Level Rest Client cannot parse weighted_avg result #36861

xpando opened this issue Dec 19, 2018 · 8 comments

Comments

@xpando
Copy link
Contributor

xpando commented Dec 19, 2018

Elasticsearch version (bin/elasticsearch --version):
"version" : {
"number" : "6.5.2",
"build_flavor" : "default",
"build_type" : "rpm",
"build_hash" : "9434bed",
"build_date" : "2018-11-29T23:58:20.891072Z",
"build_snapshot" : false,
"lucene_version" : "7.5.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
}

High level rest client version from build.gradle:
compile group: 'org.elasticsearch', name: 'elasticsearch', version: '6.5.4'
compile group: 'org.elasticsearch.client', name: 'elasticsearch-rest-high-level-client', version: '6.5.4'

Plugins installed:
[]

JVM version (java -version):
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

OS version (uname -a if on a Unix-like system):
Darwin dfindley-macbook.local 18.2.0 Darwin Kernel Version 18.2.0: Fri Oct 5 19:41:49 PDT 2018; root:xnu-4903.221.2~2/RELEASE_X86_64 x86_64

Description of the problem including expected versus actual behavior:

Steps to reproduce:

  1. create a terms aggregation with a weighted_avg sub aggregation.

The query is produced just fine and a correct response is returned from the ElasticSearch server but an exception is thrown on parsing the result. See log below.

Provide logs (if relevant):

org.elasticsearch.common.xcontent.NamedObjectNotFoundException: [1:389] unable to parse Aggregation with name [weighted_avg]: parser not found
	at org.elasticsearch.common.xcontent.NamedXContentRegistry.parseNamedObject(NamedXContentRegistry.java:132)
	at org.elasticsearch.common.xcontent.support.AbstractXContentParser.namedObject(AbstractXContentParser.java:433)
	at org.elasticsearch.common.xcontent.XContentParserUtils.parseTypedKeysObject(XContentParserUtils.java:153)
	at org.elasticsearch.search.aggregations.bucket.terms.ParsedTerms$ParsedBucket.parseTermsBucketXContent(ParsedTerms.java:139)
	at org.elasticsearch.search.aggregations.bucket.terms.ParsedLongTerms$ParsedBucket.fromXContent(ParsedLongTerms.java:82)
	at org.elasticsearch.search.aggregations.ParsedMultiBucketAggregation.lambda$declareMultiBucketAggregationFields$0(ParsedMultiBucketAggregation.java:75)
	at org.elasticsearch.common.xcontent.ObjectParser.parseValue(ObjectParser.java:314)
	at org.elasticsearch.common.xcontent.ObjectParser.parseArray(ObjectParser.java:308)
	at org.elasticsearch.common.xcontent.ObjectParser.parseSub(ObjectParser.java:329)
	at org.elasticsearch.common.xcontent.ObjectParser.parse(ObjectParser.java:168)
	at org.elasticsearch.common.xcontent.ObjectParser.parse(ObjectParser.java:131)
	at org.elasticsearch.search.aggregations.bucket.terms.ParsedLongTerms.fromXContent(ParsedLongTerms.java:42)
	at org.elasticsearch.client.RestHighLevelClient.lambda$getDefaultNamedXContents$38(RestHighLevelClient.java:1850)
	at org.elasticsearch.common.xcontent.NamedXContentRegistry.parseNamedObject(NamedXContentRegistry.java:141)
	at org.elasticsearch.common.xcontent.support.AbstractXContentParser.namedObject(AbstractXContentParser.java:433)
	at org.elasticsearch.common.xcontent.XContentParserUtils.parseTypedKeysObject(XContentParserUtils.java:153)
	at org.elasticsearch.search.aggregations.Aggregations.fromXContent(Aggregations.java:141)
	at org.elasticsearch.action.search.SearchResponse.innerFromXContent(SearchResponse.java:289)
	at org.elasticsearch.action.search.SearchResponse.fromXContent(SearchResponse.java:248)
	at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:1793)
	at org.elasticsearch.client.RestHighLevelClient.lambda$performRequestAndParseEntity$9(RestHighLevelClient.java:1526)
	at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1610)
	at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1563)
	at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1525)
	at org.elasticsearch.client.RestHighLevelClient.search(RestHighLevelClient.java:990)
@polyfractal
Copy link
Contributor

The weighted avg had some issues which were fixed in 6.5.4: #36525

Could you try on the newer version and see if that fixes your issues?

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features

@xpando
Copy link
Contributor Author

xpando commented Dec 20, 2018

I did run it on the latest 6.5.4 and still had the problem. I originally had this issue: #36525 and I started using the 6.5.4-SNAPSHOT builds a couple of days ago which fixed that issue but not the one I'm reporting here. Today I upgraded to the released 6.5.4 version and it still has a problem parsing the query result. I can take the generated JSON query that is being sent to ES and use curl/postman to verify that the query works and returns expected data but executing the query via the high level rest client produces the above exception when parsing the response.

@xpando
Copy link
Contributor Author

xpando commented Dec 22, 2018

I created the following integration test to reproduce the issue: xpando@33f9eb7

Produced the same error:

nested: NamedObjectNotFoundException[[1:284] unable to parse Aggregation with name [weighted_avg]: parser not found];

Let me know if you'd prefer a PR for the integration test.

Test run details:

<testsuite errors="1" failures="0" tests="1" skipped="0" name="org.elasticsearch.client.SearchIT" hostname="nohost.nodomain" time="5.249" timestamp="2018-12-21T17:25:58">
   <properties class="java.util.ArrayList">
      <property name="awt.toolkit" value="sun.lwawt.macosx.LWCToolkit"/>
      <property name="compiler.java" value="11"/>
      <property name="es.aggregations.enable_scripted_metric_agg_param" value="false"/>
      <property name="es.scripting.update.ctx_in_params" value="false"/>
      <property name="file.encoding" value="UTF-8"/>
      <property name="file.separator" value="/"/>
      <property name="ftp.nonProxyHosts" value="local|*.local|169.254/16|*.169.254/16"/>
      <property name="gopherProxySet" value="false"/>
      <property name="http.nonProxyHosts" value="local|*.local|169.254/16|*.169.254/16"/>
      <property name="java.awt.graphicsenv" value="sun.awt.CGraphicsEnvironment"/>
      <property name="java.awt.headless" value="true"/>
      <property name="java.awt.printerjob" value="sun.lwawt.macosx.CPrinterJob"/>
      <property name="java.class.path" value="/Users/david/Code/elasticsearch/client/rest-high-level/build/classes/java/test:/Users/david/Code/elasticsearch/client/rest-high-level/build/resources/test:/Users/david/Code/elasticsearch/client/rest-high-level/build/resources/main:/Users/david/Code/elasticsearch/test/framework/build/distributions/framework-6.5.5-SNAPSHOT.jar:/Users/david/Code/elasticsearch/server/build/distributions/elasticsearch-6.5.5-SNAPSHOT.jar:/Users/david/Code/elasticsearch/client/sniffer/build/distributions/elasticsearch-rest-client-sniffer-6.5.5-SNAPSHOT.jar:/Users/david/Code/elasticsearch/client/rest/build/distributions/elasticsearch-rest-client-6.5.5-SNAPSHOT.jar:/Users/david/Code/elasticsearch/modules/parent-join/build/distributions/parent-join-client-6.5.5-SNAPSHOT.jar:/Users/david/Code/elasticsearch/modules/aggs-matrix-stats/build/distributions/aggs-matrix-stats-client-6.5.5-SNAPSHOT.jar:/Users/david/Code/elasticsearch/modules/rank-eval/build/distributions/rank-eval-client-6.5.5-SNAPSHOT.jar:/Users/david/Code/elasticsearch/modules/lang-mustache/build/distributions/lang-mustache-client-6.5.5-SNAPSHOT.jar:/Users/david/Code/elasticsearch/client/test/build/distributions/test-6.5.5-SNAPSHOT.jar:/Users/david/.gradle/caches/modules-2/files-2.1/com.carrotsearch.randomizedtesting/randomizedtesting-runner/2.7.0/742822b0d4e06f695fd64c7af556eeb5864e2869/randomizedtesting-runner-2.7.0.jar:/Users/david/.gradle/caches/modules-2/files-2.1/junit/junit/4.12/2973d150c0dc1fefe998f834810d68f278ea58ec/junit-4.12.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-all/1.3/63a21ebc981131004ad02e0434e799fd7f3a8d5a/hamcrest-all-1.3.jar:/Users/david/Code/elasticsearch/rest-api-spec/build/distributions/rest-api-spec-6.5.5-SNAPSHOT.jar:/Users/david/Code/elasticsearch/libs/x-content/build/distributions/elasticsearch-x-content-6.5.5-SNAPSHOT.jar:/Users/david/Code/elasticsearch/libs/cli/build/distributions/elasticsearch-cli-6.5.5-SNAPSHOT.jar:/Users/david/Code/elasticsearch/libs/core/build/distributions/elasticsearch-core-6.5.5-SNAPSHOT.jar:/Users/david/Code/elasticsearch/libs/secure-sm/build/distributions/elasticsearch-secure-sm-6.5.5-SNAPSHOT.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.apache.lucene/lucene-core/7.5.0/736e94305e2a0e803563c5b184877df5c7d4cb69/lucene-core-7.5.0.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.apache.lucene/lucene-analyzers-common/7.5.0/e7fbdfc2297c3ff5d194d7bef95810504e52710e/lucene-analyzers-common-7.5.0.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.apache.lucene/lucene-backward-codecs/7.5.0/3ebd10f4a1fe71a92b69c0d653136bcf9790a165/lucene-backward-codecs-7.5.0.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.apache.lucene/lucene-grouping/7.5.0/f326a63640a288c302c713fcf2965fdc827b3cca/lucene-grouping-7.5.0.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.apache.lucene/lucene-highlighter/7.5.0/59420a5e30f12885f160e49bb975ab6b5985bd3d/lucene-highlighter-7.5.0.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.apache.lucene/lucene-join/7.5.0/65d3c275b094383640d393579cdb7aff22bcd1d/lucene-join-7.5.0.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.apache.lucene/lucene-memory/7.5.0/b8cc0c311a823287264653fbd05f866e059d303c/lucene-memory-7.5.0.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.apache.lucene/lucene-misc/7.5.0/60d0a02b9297b5423d5400a6b0aa114915232b60/lucene-misc-7.5.0.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.apache.lucene/lucene-queries/7.5.0/bfbf786b75c60a25daf33d389efd6458e17218d9/lucene-queries-7.5.0.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.apache.lucene/lucene-queryparser/7.5.0/3eefb522e150f2ba0009df20f3bcfa91d60e7090/lucene-queryparser-7.5.0.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.apache.lucene/lucene-sandbox/7.5.0/9fa3bb1c81179e112a62c0db6749767127c616bd/lucene-sandbox-7.5.0.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.apache.lucene/lucene-spatial/7.5.0/8de64a6a8ad22b5849f2ab5f824917723de7a349/lucene-spatial-7.5.0.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.apache.lucene/lucene-spatial-extras/7.5.0/b0892bbc0dc16ca07cf98897df3b3e9ed3069615/lucene-spatial-extras-7.5.0.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.apache.lucene/lucene-spatial3d/7.5.0/672920a7fb48624bcb84ce0ee67dd0c7bc080c94/lucene-spatial3d-7.5.0.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.apache.lucene/lucene-suggest/7.5.0/aa7d170871711ebd4dbd367d7b8ee0f1eb5e88b7/lucene-suggest-7.5.0.jar:/Users/david/.gradle/caches/modules-2/files-2.1/com.carrotsearch/hppc/0.7.1/8b5057f74ea378c0150a1860874a3ebdcb713767/hppc-0.7.1.jar:/Users/david/.gradle/caches/modules-2/files-2.1/joda-time/joda-time/2.10.1/9ac3dbf89dbf2ee385185dd0cd3064fe789efee0/joda-time-2.10.1.jar:/Users/david/.gradle/caches/modules-2/files-2.1/com.tdunning/t-digest/3.2/2ab94758b0276a8a26102adf8d528cf6d0567b9a/t-digest-3.2.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.hdrhistogram/HdrHistogram/2.1.9/e4631ce165eb400edecfa32e03d3f1be53dee754/HdrHistogram-2.1.9.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.locationtech.spatial4j/spatial4j/0.7/faa8ba85d503da4ab872d17ba8c00da0098ab2f2/spatial4j-0.7.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.locationtech.jts/jts-core/1.15.0/705981b7e25d05a76a3654e597dab6ba423eb79e/jts-core-1.15.0.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-api/2.11.1/268f0fe4df3eefe052b57c87ec48517d64fb2a10/log4j-api-2.11.1.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-core/2.11.1/592a48674c926b01a9a747c7831bcd82a9e6d6e4/log4j-core-2.11.1.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-1.2-api/2.11.1/3aba3398fe064a3eab4331f88161c7480e848418/log4j-1.2-api-2.11.1.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.elasticsearch/jna/4.5.1/da10908ae23dc59b19dc258e63aea1c44621dc3a/jna-4.5.1.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpclient/4.5.2/733db77aa8d9b2d68015189df76ab06304406e50/httpclient-4.5.2.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpcore/4.4.5/e7501a1b34325abb00d17dde96150604a0658b54/httpcore-4.4.5.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpasyncclient/4.1.2/95aa3e6fb520191a0970a73cf09f62948ee614be/httpasyncclient-4.1.2.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpcore-nio/4.4.5/f4be009e7505f6ceddf21e7960c759f413f15056/httpcore-nio-4.4.5.jar:/Users/david/.gradle/caches/modules-2/files-2.1/commons-codec/commons-codec/1.10/4b95f4897fa13f2cd904aee711aeafc0c5295cd8/commons-codec-1.10.jar:/Users/david/.gradle/caches/modules-2/files-2.1/commons-logging/commons-logging/1.1.3/f6f66e966c70a83ffbdb6f17a0919eaf7c8aca7f/commons-logging-1.1.3.jar:/Users/david/.gradle/caches/modules-2/files-2.1/com.github.spullara.mustache.java/compiler/0.9.3/2815e016c63bec4f18704ea4f5489106a5b01a99/compiler-0.9.3.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.apache.lucene/lucene-test-framework/7.5.0/2cac4bfbd4d9bdf62ce3f91f8a73d3cb8ead495c/lucene-test-framework-7.5.0.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.apache.lucene/lucene-codecs/7.5.0/c72173d3dd72990cd4d447a9ce0834cb03b877bc/lucene-codecs-7.5.0.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.elasticsearch/securemock/1.2/98201d4ad5ac93f6b415ae9172d52b5e7cda490e/securemock-1.2.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.elasticsearch/mocksocket/1.2/190ad3f42fd6ab7367bae0c0e14d1dc4e4a3c361/mocksocket-1.2.jar:/Users/david/.gradle/caches/modules-2/files-2.1/org.yaml/snakeyaml/1.17/7a27ea250c5130b2922b86dea63cbb1cc10a660c/snakeyaml-1.17.jar:/Users/david/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-core/2.8.11/876ead1db19f0c9e79c9789273a3ef8c6fd6c29b/jackson-core-2.8.11.jar:/Users/david/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.dataformat/jackson-dataformat-smile/2.8.11/d9d1c49c5d9d5e46e2aee55f3cdd119286fe0fc1/jackson-dataformat-smile-2.8.11.jar:/Users/david/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/2.8.11/2e77c6ff7342cd61ab1ae7cb14ed16aebfc8a72a/jackson-dataformat-yaml-2.8.11.jar:/Users/david/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.dataformat/jackson-dataformat-cbor/2.8.11/8b9826e16c3366764bfb7ad7362554f0471046c3/jackson-dataformat-cbor-2.8.11.jar:/Users/david/.gradle/caches/modules-2/files-2.1/net.sf.jopt-simple/jopt-simple/5.0.2/98cafc6081d5632b61be2c9e60650b64ddbc637c/jopt-simple-5.0.2.jar:/Users/david/Code/elasticsearch/client/rest-high-level/build/distributions/elasticsearch-rest-high-level-client-6.5.5-SNAPSHOT.jar:/Users/david/.gradle/caches/modules-2/files-2.1/com.carrotsearch.randomizedtesting/junit4-ant/2.7.0/b157612539dd16f4f0292e817354be01a432ad67/junit4-ant-2.7.0.jar"/>
      <property name="java.class.version" value="55.0"/>
      <property name="java.home" value="/Library/Java/JavaVirtualMachines/adoptopenjdk-11.0.1.jdk/Contents/Home"/>
      <property name="java.io.tmpdir" value="./temp"/>
      <property name="java.library.path" value="/Users/david/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:."/>
      <property name="java.runtime.name" value="OpenJDK Runtime Environment"/>
      <property name="java.runtime.version" value="11.0.1+13"/>
      <property name="java.specification.name" value="Java Platform API Specification"/>
      <property name="java.specification.vendor" value="Oracle Corporation"/>
      <property name="java.specification.version" value="11"/>
      <property name="java.vendor" value="AdoptOpenJDK"/>
      <property name="java.vendor.url" value="https://adoptopenjdk.net/"/>
      <property name="java.vendor.url.bug" value="http://bugreport.java.com/bugreport/"/>
      <property name="java.vendor.version" value="AdoptOpenJDK"/>
      <property name="java.version" value="11.0.1"/>
      <property name="java.version.date" value="2018-10-16"/>
      <property name="java.vm.compressedOopsMode" value="Zero based"/>
      <property name="java.vm.info" value="mixed mode"/>
      <property name="java.vm.name" value="OpenJDK 64-Bit Server VM"/>
      <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
      <property name="java.vm.specification.vendor" value="Oracle Corporation"/>
      <property name="java.vm.specification.version" value="11"/>
      <property name="java.vm.vendor" value="AdoptOpenJDK"/>
      <property name="java.vm.version" value="11.0.1+13"/>
      <property name="jdk.debug" value="release"/>
      <property name="jna.nosys" value="true"/>
      <property name="junit4.childvm.count" value="1"/>
      <property name="junit4.childvm.cwd" value="/Users/david/Code/elasticsearch/client/rest-high-level/build/testrun/integTestRunner/J0"/>
      <property name="junit4.childvm.id" value="0"/>
      <property name="junit4.memory.total" value="536870912"/>
      <property name="junit4.pidString" value="89775@turtlebookpro.local"/>
      <property name="junit4.processors" value="12"/>
      <property name="junit4.tempDir" value="/Users/david/Code/elasticsearch/client/rest-high-level/build/testrun/integTestRunner/temp"/>
      <property name="line.separator" value="
"/>
      <property name="os.arch" value="x86_64"/>
      <property name="os.name" value="Mac OS X"/>
      <property name="os.version" value="10.14.2"/>
      <property name="path.separator" value=":"/>
      <property name="runtime.java" value="11"/>
      <property name="socksNonProxyHosts" value="local|*.local|169.254/16|*.169.254/16"/>
      <property name="sun.arch.data.model" value="64"/>
      <property name="sun.boot.library.path" value="/Library/Java/JavaVirtualMachines/adoptopenjdk-11.0.1.jdk/Contents/Home/lib"/>
      <property name="sun.cpu.endian" value="little"/>
      <property name="sun.cpu.isalist" value=""/>
      <property name="sun.io.unicode.encoding" value="UnicodeBig"/>
      <property name="sun.java.command" value="com.carrotsearch.ant.tasks.junit4.slave.SlaveMainSafe -flush -eventsfile /Users/david/Code/elasticsearch/client/rest-high-level/build/testrun/integTestRunner/temp/junit4-J0-20181221_172558_1057767211526315238616.events @/Users/david/Code/elasticsearch/client/rest-high-level/build/testrun/integTestRunner/temp/junit4-J0-20181221_172558_1051141237195973923849.suites -stdin"/>
      <property name="sun.java.launcher" value="SUN_STANDARD"/>
      <property name="sun.jnu.encoding" value="UTF-8"/>
      <property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
      <property name="sun.os.patch.level" value="unknown"/>
      <property name="tests.artifact" value="rest-high-level"/>
      <property name="tests.class" value="*SearchIT*"/>
      <property name="tests.cluster" value="[::1]:54002"/>
      <property name="tests.config.dir" value="/Users/david/Code/elasticsearch/client/rest-high-level/build/cluster/integTestCluster node0/elasticsearch-6.5.5-SNAPSHOT/config"/>
      <property name="tests.gradle" value="true"/>
      <property name="tests.logger.level" value="WARN"/>
      <property name="tests.method" value="*Weight*"/>
      <property name="tests.prefix" value="tests"/>
      <property name="tests.rest.cluster" value="[::1]:54010"/>
      <property name="tests.rest.cluster.password" value="test-password"/>
      <property name="tests.rest.cluster.username" value="test_user"/>
      <property name="tests.rest.load_packaged" value="false"/>
      <property name="tests.security.manager" value="true"/>
      <property name="tests.seed" value="B6150ADDCD04C5E2"/>
      <property name="tests.task" value=":client:rest-high-level:integTestRunner"/>
      <property name="user.country" value="US"/>
      <property name="user.dir" value="/Users/david/Code/elasticsearch/client/rest-high-level/build/testrun/integTestRunner/J0"/>
      <property name="user.home" value="/Users/david"/>
      <property name="user.language" value="en"/>
      <property name="user.name" value="david"/>
      <property name="user.timezone" value=""/>
   </properties>
   <testcase classname="org.elasticsearch.client.SearchIT" name="testSearchWithTermsAndWeightedAvg" time="4.289">
      <error message="Failed execution" type="org.elasticsearch.common.util.concurrent.UncategorizedExecutionException">UncategorizedExecutionException[Failed execution]; nested: ExecutionException[java.io.IOException: Unable to parse response body for Response{requestLine=POST /index/_search?typed_keys=true&amp;ignore_unavailable=false&amp;expand_wildcards=open&amp;allow_no_indices=true&amp;search_type=query_then_fetch&amp;batched_reduce_size=512 HTTP/1.1, host=http://[::1]:54010, response=HTTP/1.1 200 OK}]; nested: IOException[Unable to parse response body for Response{requestLine=POST /index/_search?typed_keys=true&amp;ignore_unavailable=false&amp;expand_wildcards=open&amp;allow_no_indices=true&amp;search_type=query_then_fetch&amp;batched_reduce_size=512 HTTP/1.1, host=http://[::1]:54010, response=HTTP/1.1 200 OK}]; nested: XContentParseException[[1:284] [ParsedStringTerms] failed to parse field [buckets]]; nested: NamedObjectNotFoundException[[1:284] unable to parse Aggregation with name [weighted_avg]: parser not found];
	at __randomizedtesting.SeedInfo.seed([B6150ADDCD04C5E2:8882A6B4996CFB6C]:0)
	at org.elasticsearch.common.util.concurrent.FutureUtils.rethrowExecutionException(FutureUtils.java:101)
	at org.elasticsearch.common.util.concurrent.FutureUtils.get(FutureUtils.java:62)
	at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:34)
	at org.elasticsearch.client.ESRestHighLevelClientTestCase.execute(ESRestHighLevelClientTestCase.java:103)
	at org.elasticsearch.client.SearchIT.testSearchWithTermsAndWeightedAvg(SearchIT.java:385)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.carrotsearch.randomizedtesting.RandomizedRunner.invoke(RandomizedRunner.java:1750)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$8.evaluate(RandomizedRunner.java:938)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$9.evaluate(RandomizedRunner.java:974)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$10.evaluate(RandomizedRunner.java:988)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at org.apache.lucene.util.TestRuleSetupTeardownChained$1.evaluate(TestRuleSetupTeardownChained.java:49)
	at org.apache.lucene.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:45)
	at org.apache.lucene.util.TestRuleThreadAndTestName$1.evaluate(TestRuleThreadAndTestName.java:48)
	at org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:64)
	at org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:47)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368)
	at com.carrotsearch.randomizedtesting.ThreadLeakControl.forkTimeoutingTask(ThreadLeakControl.java:817)
	at com.carrotsearch.randomizedtesting.ThreadLeakControl$3.evaluate(ThreadLeakControl.java:468)
	at com.carrotsearch.randomizedtesting.RandomizedRunner.runSingleTest(RandomizedRunner.java:947)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$5.evaluate(RandomizedRunner.java:832)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$6.evaluate(RandomizedRunner.java:883)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$7.evaluate(RandomizedRunner.java:894)
	at org.apache.lucene.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:45)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at org.apache.lucene.util.TestRuleStoreClassName$1.evaluate(TestRuleStoreClassName.java:41)
	at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
	at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:53)
	at org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:47)
	at org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:64)
	at org.apache.lucene.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:54)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.util.concurrent.ExecutionException: java.io.IOException: Unable to parse response body for Response{requestLine=POST /index/_search?typed_keys=true&amp;ignore_unavailable=false&amp;expand_wildcards=open&amp;allow_no_indices=true&amp;search_type=query_then_fetch&amp;batched_reduce_size=512 HTTP/1.1, host=http://[::1]:54010, response=HTTP/1.1 200 OK}
	at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.getValue(BaseFuture.java:265)
	at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.get(BaseFuture.java:252)
	at org.elasticsearch.common.util.concurrent.BaseFuture.get(BaseFuture.java:94)
	at org.elasticsearch.common.util.concurrent.FutureUtils.get(FutureUtils.java:57)
	... 39 more
Caused by: java.io.IOException: Unable to parse response body for Response{requestLine=POST /index/_search?typed_keys=true&amp;ignore_unavailable=false&amp;expand_wildcards=open&amp;allow_no_indices=true&amp;search_type=query_then_fetch&amp;batched_reduce_size=512 HTTP/1.1, host=http://[::1]:54010, response=HTTP/1.1 200 OK}
	at org.elasticsearch.client.RestHighLevelClient$1.onSuccess(RestHighLevelClient.java:1723)
	at org.elasticsearch.client.RestClient$FailureTrackingResponseListener.onSuccess(RestClient.java:842)
	at org.elasticsearch.client.RestClient$1.completed(RestClient.java:543)
	at org.elasticsearch.client.RestClient$1.completed(RestClient.java:531)
	at org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:119)
	at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseCompleted(DefaultClientExchangeHandlerImpl.java:177)
	at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.processResponse(HttpAsyncRequestExecutor.java:436)
	at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.inputReady(HttpAsyncRequestExecutor.java:326)
	at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:265)
	at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81)
	at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39)
	at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114)
	at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162)
	at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337)
	at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315)
	at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276)
	at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
	at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:588)
	... 1 more
Caused by: org.elasticsearch.common.xcontent.XContentParseException: [1:284] [ParsedStringTerms] failed to parse field [buckets]
	at org.elasticsearch.common.xcontent.ObjectParser.parseValue(ObjectParser.java:316)
	at org.elasticsearch.common.xcontent.ObjectParser.parseArray(ObjectParser.java:308)
	at org.elasticsearch.common.xcontent.ObjectParser.parseSub(ObjectParser.java:329)
	at org.elasticsearch.common.xcontent.ObjectParser.parse(ObjectParser.java:168)
	at org.elasticsearch.common.xcontent.ObjectParser.parse(ObjectParser.java:131)
	at org.elasticsearch.search.aggregations.bucket.terms.ParsedStringTerms.fromXContent(ParsedStringTerms.java:44)
	at org.elasticsearch.client.RestHighLevelClient.lambda$getDefaultNamedXContents$37(RestHighLevelClient.java:1849)
	at org.elasticsearch.common.xcontent.NamedXContentRegistry.parseNamedObject(NamedXContentRegistry.java:141)
	at org.elasticsearch.common.xcontent.support.AbstractXContentParser.namedObject(AbstractXContentParser.java:433)
	at org.elasticsearch.common.xcontent.XContentParserUtils.parseTypedKeysObject(XContentParserUtils.java:153)
	at org.elasticsearch.search.aggregations.Aggregations.fromXContent(Aggregations.java:141)
	at org.elasticsearch.action.search.SearchResponse.innerFromXContent(SearchResponse.java:289)
	at org.elasticsearch.action.search.SearchResponse.fromXContent(SearchResponse.java:248)
	at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:1793)
	at org.elasticsearch.client.RestHighLevelClient.lambda$performRequestAsyncAndParseEntity$12(RestHighLevelClient.java:1636)
	at org.elasticsearch.client.RestHighLevelClient$1.onSuccess(RestHighLevelClient.java:1721)
	... 18 more
Caused by: org.elasticsearch.common.xcontent.NamedObjectNotFoundException: [1:284] unable to parse Aggregation with name [weighted_avg]: parser not found
	at org.elasticsearch.common.xcontent.NamedXContentRegistry.parseNamedObject(NamedXContentRegistry.java:132)
	at org.elasticsearch.common.xcontent.support.AbstractXContentParser.namedObject(AbstractXContentParser.java:433)
	at org.elasticsearch.common.xcontent.XContentParserUtils.parseTypedKeysObject(XContentParserUtils.java:153)
	at org.elasticsearch.search.aggregations.bucket.terms.ParsedTerms$ParsedBucket.parseTermsBucketXContent(ParsedTerms.java:139)
	at org.elasticsearch.search.aggregations.bucket.terms.ParsedStringTerms$ParsedBucket.fromXContent(ParsedStringTerms.java:83)
	at org.elasticsearch.search.aggregations.ParsedMultiBucketAggregation.lambda$declareMultiBucketAggregationFields$0(ParsedMultiBucketAggregation.java:75)
	at org.elasticsearch.common.xcontent.ObjectParser.parseValue(ObjectParser.java:314)
	... 33 more
</error>
   </testcase>
   <system-out><![CDATA[[2018-12-21T17:25:59,306][WARN ][o.e.b.JNANatives         ] [[SUITE-SearchIT-seed#[B6150ADDCD04C5E2]]] Unable to lock JVM Memory: error=78, reason=Function not implemented
[2018-12-21T17:25:59,309][WARN ][o.e.b.JNANatives         ] [[SUITE-SearchIT-seed#[B6150ADDCD04C5E2]]] This can result in part of the JVM being swapped out.
[2018-12-22T04:25:59,617][INFO ][o.e.c.SearchIT           ] [testSearchWithTermsAndWeightedAvg] before test
[2018-12-22T04:25:59,714][INFO ][o.e.c.SearchIT           ] [testSearchWithTermsAndWeightedAvg] initializing REST clients against [http://[::1]:54010]
[2018-12-22T04:26:00,710][WARN ][o.e.c.RestClient         ] [[I/O dispatcher 2]] request [PUT http://[::1]:54010/index/type/1] returned 1 warnings: [299 Elasticsearch-6.5.5-SNAPSHOT-33f9eb7 "the default number of shards will change from [5] to [1] in 7.0.0; if you wish to continue using the default of [5] shards, you must manage this on the create index request or with an index template" "Fri, 21 Dec 2018 23:26:00 GMT"]
[2018-12-22T04:26:01,376][WARN ][o.e.c.RestClient         ] [[I/O dispatcher 2]] request [PUT http://[::1]:54010/index1/doc/1] returned 1 warnings: [299 Elasticsearch-6.5.5-SNAPSHOT-33f9eb7 "the default number of shards will change from [5] to [1] in 7.0.0; if you wish to continue using the default of [5] shards, you must manage this on the create index request or with an index template" "Fri, 21 Dec 2018 23:26:00 GMT"]
[2018-12-22T04:26:01,929][WARN ][o.e.c.RestClient         ] [[I/O dispatcher 2]] request [PUT http://[::1]:54010/index2] returned 1 warnings: [299 Elasticsearch-6.5.5-SNAPSHOT-33f9eb7 "the default number of shards will change from [5] to [1] in 7.0.0; if you wish to continue using the default of [5] shards, you must manage this on the create index request or with an index template" "Fri, 21 Dec 2018 23:26:01 GMT"]
[2018-12-22T04:26:02,594][WARN ][o.e.c.RestClient         ] [[I/O dispatcher 2]] request [PUT http://[::1]:54010/index3/doc/5] returned 1 warnings: [299 Elasticsearch-6.5.5-SNAPSHOT-33f9eb7 "the default number of shards will change from [5] to [1] in 7.0.0; if you wish to continue using the default of [5] shards, you must manage this on the create index request or with an index template" "Fri, 21 Dec 2018 23:26:02 GMT"]
[2018-12-22T04:26:03,159][WARN ][o.e.c.RestClient         ] [[I/O dispatcher 2]] request [PUT http://[::1]:54010/index4] returned 1 warnings: [299 Elasticsearch-6.5.5-SNAPSHOT-33f9eb7 "the default number of shards will change from [5] to [1] in 7.0.0; if you wish to continue using the default of [5] shards, you must manage this on the create index request or with an index template" "Fri, 21 Dec 2018 23:26:02 GMT"]
[2018-12-22T04:26:03,883][INFO ][o.e.c.SearchIT           ] [testSearchWithTermsAndWeightedAvg] after test
]]></system-out>
   <system-err><![CDATA[REPRODUCE WITH: ./gradlew :client:rest-high-level:integTestRunner -Dtests.seed=B6150ADDCD04C5E2 -Dtests.class=org.elasticsearch.client.SearchIT -Dtests.method="testSearchWithTermsAndWeightedAvg" -Dtests.security.manager=true -Dtests.locale=luy-KE -Dtests.timezone=Asia/Dushanbe -Dcompiler.java=11 -Druntime.java=11
NOTE: leaving temporary files on disk at: /Users/david/Code/elasticsearch/client/rest-high-level/build/testrun/integTestRunner/J0/temp/org.elasticsearch.client.SearchIT_B6150ADDCD04C5E2-001
NOTE: test params are: codec=Asserting(Lucene70): {}, docValues:{}, maxPointsInLeafNode=1286, maxMBSortInHeap=7.109953822562061, sim=RandomSimilarity(queryNorm=false): {}, locale=luy-KE, timezone=Asia/Dushanbe
NOTE: Mac OS X 10.14.2 x86_64/AdoptOpenJDK 11.0.1 (64-bit)/cpus=12,threads=1,free=496531312,total=536870912
NOTE: All tests run in this JVM: [SearchIT]
]]></system-err>
</testsuite>

@xpando
Copy link
Contributor Author

xpando commented Dec 27, 2018

Update: I fixed this issue in my fork and the integration test is passing. I'll submit a pull request shortly with the fix.

@polyfractal
Copy link
Contributor

Thanks for fixing this @xpando! Sorry for being absent, was off on holiday :)

@xpando
Copy link
Contributor Author

xpando commented Jan 3, 2019

No worries! Glad I could help.

hub-cap pushed a commit that referenced this issue Jan 4, 2019
Add integration test for weighted avg sub aggregation
Add weighted avg parser to DefaultNamedXContents

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

No branches or pull requests

3 participants