简体   繁体   English

"<i>ElasticsearchException[Failed to parse info response.<\/i> ElasticsearchException [无法解析信息响应。<\/b> <i>Check logs for detailed information - Unsupported Content-Type: text\/html;<\/i>检查日志以获取详细信息 - 不支持的内容类型:文本\/html;<\/b> <i>charset=utf-8]<\/i>字符集=utf-8]<\/b>"

[英]ElasticsearchException[Failed to parse info response. Check logs for detailed information - Unsupported Content-Type: text/html; charset=utf-8]

I'm using Elastic Java API in my project and there's a strange server error performing here.我在我的项目中使用 Elastic Java API,这里执行了一个奇怪的服务器错误。 For a reason "Accept" header doesn't work here while it's ok with Rest API.出于某种原因,“Accept”标头在这里不起作用,而 Rest API 可以。 Are there any options I should set also or instead of existing ones'?是否有任何我应该设置的选项或代替现有的选项?

Here is my code (I'm using Kotlin):这是我的代码(我正在使用 Kotlin):

fun search(
    queryBuilder: QueryBuilder,
    //index: String,
    limit: Int? = null,
    offset: Int? = null,
    options: RequestOptions = RequestOptions
        .DEFAULT
        .toBuilder()
        .addHeader("Accept", ContentType.APPLICATION_JSON.mimeType)
        .addHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.mimeType)
        .build()
): Array<out SearchHit> = ElasticConnection.connection {
    val request = SearchSourceBuilder()
        .query(queryBuilder)
        .apply {
            offset?.run(::from)
            limit?.run(::size)
        }
        .let(SearchRequest().indices(index)::source)
    search(request, options)
        .hits
        .hits

And here's a stack trace这是一个堆栈跟踪

java.lang.IllegalStateException: Unsupported Content-Type: text/html; charset=utf-8
    at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:2008) ~[elasticsearch-rest-high-level-client-7.15.1.jar:7.15.1]
    at org.elasticsearch.client.RestHighLevelClient.getVersionValidation(RestHighLevelClient.java:2161) ~[elasticsearch-rest-high-level-client-7.15.1.jar:7.15.1]
    at org.elasticsearch.client.RestHighLevelClient.access$100(RestHighLevelClient.java:253) ~[elasticsearch-rest-high-level-client-7.15.1.jar:7.15.1]
    at org.elasticsearch.client.RestHighLevelClient$5.onSuccess(RestHighLevelClient.java:2123) ~[elasticsearch-rest-high-level-client-7.15.1.jar:7.15.1]
    at org.elasticsearch.client.RestClient$FailureTrackingResponseListener.onSuccess(RestClient.java:636) ~[elasticsearch-rest-client-7.15.1.jar:7.15.1]
    at org.elasticsearch.client.RestClient$1.completed(RestClient.java:376) ~[elasticsearch-rest-client-7.15.1.jar:7.15.1]
    at org.elasticsearch.client.RestClient$1.completed(RestClient.java:370) ~[elasticsearch-rest-client-7.15.1.jar:7.15.1]
    at org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:122) ~[httpcore-4.4.13.jar:4.4.13]
    at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseCompleted(DefaultClientExchangeHandlerImpl.java:181) ~[httpasyncclient-4.1.4.jar:4.1.4]
    at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.processResponse(HttpAsyncRequestExecutor.java:448) ~[httpcore-nio-4.4.13.jar:4.4.13]
    at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.inputReady(HttpAsyncRequestExecutor.java:338) ~[httpcore-nio-4.4.13.jar:4.4.13]
    at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:265) ~[httpcore-nio-4.4.13.jar:4.4.13]
    at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81) ~[httpasyncclient-4.1.4.jar:4.1.4]
    at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39) ~[httpasyncclient-4.1.4.jar:4.1.4]
    at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:121) ~[httpcore-nio-4.4.13.jar:4.4.13]
    at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162) ~[httpcore-nio-4.4.13.jar:4.4.13]
    at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337) ~[httpcore-nio-4.4.13.jar:4.4.13]
    at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315) ~[httpcore-nio-4.4.13.jar:4.4.13]
    at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276) ~[httpcore-nio-4.4.13.jar:4.4.13]
    at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) ~[httpcore-nio-4.4.13.jar:4.4.13]
    at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:591) ~[httpcore-nio-4.4.13.jar:4.4.13]
    at java.base/java.lang.Thread.run(Thread.java:832) ~[na:na]

}

In my case, I had used the wrong config for Elasticsearch host.就我而言,我为 Elasticsearch 主机使用了错误的配置。 I had set the host endpoint to that of Kibana instead of Elasticsearch.我已将host端点设置为 Kibana 而不是 Elasticsearch。

Kibana endpoint: <cluster-name>.kb.us-east-1.aws.found.io:9243 Kibana 端点: <cluster-name>.kb.us-east-1.aws.found.io:9243

ES endpoint: <cluster-name>.es.us-east-1.aws.found.io:9243 ES 端点: <cluster-name>.es.us-east-1.aws.found.io:9243

Notice the kb vs es in the endpoints.注意端点中的kbes

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 不支持的内容类型:text / html; charset = UTF-8支持的是:Jdev中的[text / xml] - Unsupported Content-Type: text/html; charset=UTF-8 Supported ones are: [text/xml] in Jdev 不支持的内容类型:文本/xml; charset=utf-8 支持的有:[application/soap+xml] - Unsupported Content-Type: text/xml; charset=utf-8 Supported ones are: [application/soap+xml] 是内容类型“text/xml; 字符集=utf-8”错了吗? - Is content-type “text/xml; charset=utf-8” wrong? 如何在 Spring boot(v2.4.2) 中从 Content-Type 响应头中删除 charset=UTF-8 - How to remove charset=UTF-8 from Content-Type response header in Spring boot(v2.4.2) AWS SNS http 订阅返回“不支持的媒体类型:不支持内容类型‘text/plain;charset=UTF-8’” - AWS SNS http suscription return "Unsupported Media Type: Content type 'text/plain;charset=UTF-8' not supported" 提取类型 [class org.springframework.http.ResponseEntity] 和内容类型 [text/html;charset=UTF-8] 的响应时出错; - Error while extracting response for type [class org.springframework.http.ResponseEntity] and content type [text/html;charset=UTF-8]; MessageBodyProviderNotFoundException:未找到 Media type=text/html;charset=UTF-8 的 MessageBodyReader - MessageBodyProviderNotFoundException: MessageBodyReader not found for media type=text/html;charset=UTF-8 MIME媒体类型text / html的阅读器; 找不到字符集= UTF-8 - Reader for MIME media type text/html; charset=UTF-8 was not found 内容类型 &#39;application/json;charset=UTF-8&#39; - Content type 'application/json;charset=UTF-8' 无法创建消息:SOAP 版本的内容类型不正确。 得到文本/xml; 字符集=UTF-8,但预期应用程序/soap+xml - Cannot create message: incorrect content-type for SOAP version. Got text/xml; charset=UTF-8, but expected application/soap+xml
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM