1、报错信息:
org.apache.flink.client.program.ProgramInvocationException: The main method caused an error: mapping source must be pairs of fieldnames and properties definition.
at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:302)
at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:198)
at org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:149)
at org.apache.flink.client.cli.CliFrontend.executeProgram(CliFrontend.java:699)
at org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:232)
at org.apache.flink.client.cli.CliFrontend.parseParameters(CliFrontend.java:916)
at org.apache.flink.client.cli.CliFrontend.lambda$main$10(CliFrontend.java:992)
at org.apache.flink.runtime.security.contexts.NoOpSecurityContext.runSecured(NoOpSecurityContext.java:30)
at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:992)
Caused by: java.lang.IllegalArgumentException: mapping source must be pairs of fieldnames and properties definition.
at org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest.buildFromSimplifiedDef(PutMappingRequest.java:199)
at org.elasticsearch.action.admin.indices.create.CreateIndexRequest.mapping(CreateIndexRequest.java:284)
at org.zdww.flink.utils.EsUtils.mappings(EsUtils.java:137)
at org.zdww.flink.utils.EsUtils.createIndex(EsUtils.java:75)
at org.zdww.flink.sink.AddSinkElasticsearch.createIndex(AddSinkElasticsearch.java:104)
at org.zdww.flink.sink.AddSinkElasticsearch.add(AddSinkElasticsearch.java:53)
at org.zdww.flink.sink.AddSinkData.getExecConfig(AddSinkData.java:158)
at org.zdww.flink.sink.AddSinkData.getModeConfig(AddSinkData.java:98)
at org.zdww.flink.sink.AddSinkData.getExecSqlConfig(AddSinkData.java:70)
at org.zdww.flink.sink.AddSinkData.add(AddSinkData.java:47)
at org.zdww.flink.utils.ExecUtil.builder(ExecUtil.java:17)
at org.zdww.flink.exec.MjzblJzlgblExec.exec(MjzblJzlgblExec.java:49)
at org.zdww.flink.main.App.main(App.java:39)
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 org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:288)
... 8 more
原因:maven导入的elasticsearch依赖版本过低,导入的包为过时的方法。
解决: mapping ()方法传入参数type,不修复导包,则mapping 方法需要加type参数_doc。或者自定义的tpye。
1)、从elasticsearch官网找到的
request.mapping("_doc",
“{\n” +
" “_doc”: {\n" +
" “properties”: {\n" +
" “message”: {\n" +
" “type”: “text”\n" +
" }\n" +
" }\n" +
" }\n" +
“}”,
XContentType.JSON);
改为
request.mapping("_doc", “datetime”, “type=date”);
多个参数
request.mapping("_doc", “datetime”, “type=date”, “string”, “type=text”);
注:es7后不用传入type参数,request.mapping( “datetime”, “type=date”);
即可。
2、
报错信息
Exception in thread "main" ElasticsearchStatusException[Elasticsearch exception [type=illegal_argument_exception, reason=Unknown char_filter type [stconvert] for [tsconvert]]]
at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:177)
at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:1406)
at org.elasticsearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:1382)
at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1269)
at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1231)
at org.elasticsearch.client.IndicesClient.create(IndicesClient.java:151)
at org.zdww.flink.utils.EsUtils.createIndex(EsUtils.java:77)
at org.zdww.flink.sink.AddSinkElasticsearch.createIndex(AddSinkElasticsearch.java:104)
at org.zdww.flink.sink.AddSinkElasticsearch.add(AddSinkElasticsearch.java:53)
at org.zdww.flink.sink.AddSinkData.getExecConfig(AddSinkData.java:158)
at org.zdww.flink.sink.AddSinkData.getModeConfig(AddSinkData.java:98)
at org.zdww.flink.sink.AddSinkData.getExecSqlConfig(AddSinkData.java:70)
at org.zdww.flink.sink.AddSinkData.add(AddSinkData.java:47)
at org.zdww.flink.utils.ExecUtil.builder(ExecUtil.java:17)
at org.zdww.flink.exec.MjzblJzlgblExec.exec(MjzblJzlgblExec.java:49)
at org.zdww.flink.main.App.main(App.java:39)
Suppressed: org.elasticsearch.client.ResponseException: method [PUT], host [http://127.0.0.1:9200], URI [/gsww_mjzbl_jzlgbl_gss_test_flink?master_timeout=30s&timeout=30s], status line [HTTP/1.1 400 Bad Request]
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Unknown char_filter type [stconvert] for [tsconvert]"}],"type":"illegal_argument_exception","reason":"Unknown char_filter type [stconvert] for [tsconvert]"},"status":400}
at org.elasticsearch.client.RestClient$SyncResponseListener.get(RestClient.java:920)
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:227)
at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1256)
... 12 more
Caused by: org.elasticsearch.client.ResponseException: method [PUT], host [http://127.0.0.1:9200], URI [/gsww_mjzbl_jzlgbl_gss_test_flink?master_timeout=30s&timeout=30s], status line [HTTP/1.1 400 Bad Request]
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Unknown char_filter type [stconvert] for [tsconvert]"}],"type":"illegal_argument_exception","reason":"Unknown char_filter type [stconvert] for [tsconvert]"},"status":400}
at org.elasticsearch.client.RestClient$1.completed(RestClient.java:540)
at org.elasticsearch.client.RestClient$1.completed(RestClient.java:529)
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.client.InternalRequestExecutor.inputReady(InternalRequestExecutor.java:83)
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)
at java.base/java.lang.Thread.run(Thread.java:834)
原因:elasticsearch没有安装插件stconvert
解决:安装对应插件
elasticsearch-6.4.2\plugins目录下安装插件,如下图:
3、报错
flink向es写入数据(es6)
报错信息如下:
2020-10-14 02:22:31,514 ERROR org.apache.flink.streaming.connectors.elasticsearch.ElasticsearchSinkBase [] - Failed Elasticsearch bulk request: Elasticsearch exception [type=illegal_argument_exception, reason=no write index is defined for alias [gsww_mjzbl_jzlgbl]. The write index may be explicitly disabled using is_write_index=false or the alias points to multiple indices without one being designated as a write index]
org.elasticsearch.ElasticsearchStatusException: Elasticsearch exception [type=illegal_argument_exception, reason=no write index is defined for alias [gsww_mjzbl_jzlgbl]. The write index may be explicitly disabled using is_write_index=false or the alias points to multiple indices without one being designated as a write index]
at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:177) ~[blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:1406) ~[blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.elasticsearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:1382) ~[blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.elasticsearch.client.RestHighLevelClient$1.onFailure(RestHighLevelClient.java:1357) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.elasticsearch.client.RestClient$FailureTrackingResponseListener.onDefinitiveFailure(RestClient.java:844) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.elasticsearch.client.RestClient$1.completed(RestClient.java:548) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.elasticsearch.client.RestClient$1.completed(RestClient.java:529) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:119) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseCompleted(DefaultClientExchangeHandlerImpl.java:177) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.processResponse(HttpAsyncRequestExecutor.java:436) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.inputReady(HttpAsyncRequestExecutor.java:326) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:265) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:588) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at java.lang.Thread.run(Thread.java:834) [?:?]
Suppressed: org.elasticsearch.client.ResponseException: method [POST], host [http://192.168.229.64:9200], URI [/_bulk?timeout=1m], status line [HTTP/1.1 400 Bad Request]
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"no write index is defined for alias [gsww_mjzbl_jzlgbl]. The write index may be explicitly disabled using is_write_index=false or the alias points to multiple indices without one being designated as a write index"}],"type":"illegal_argument_exception","reason":"no write index is defined for alias [gsww_mjzbl_jzlgbl]. The write index may be explicitly disabled using is_write_index=false or the alias points to multiple indices without one being designated as a write index"},"status":400}
at org.elasticsearch.client.RestClient$1.completed(RestClient.java:540) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.elasticsearch.client.RestClient$1.completed(RestClient.java:529) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:119) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseCompleted(DefaultClientExchangeHandlerImpl.java:177) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.processResponse(HttpAsyncRequestExecutor.java:436) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.inputReady(HttpAsyncRequestExecutor.java:326) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:265) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:588) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at java.lang.Thread.run(Thread.java:834) [?:?]
2020-10-14 02:22:32,173 ERROR org.apache.flink.streaming.connectors.elasticsearch.ElasticsearchSinkBase [] - Failed Elasticsearch bulk request: Elasticsearch exception [type=illegal_argument_exception, reason=no write index is defined for alias [gsww_mjzbl_jzlgbl]. The write index may be explicitly disabled using is_write_index=false or the alias points to multiple indices without one being designated as a write index]
org.elasticsearch.ElasticsearchStatusException: Elasticsearch exception [type=illegal_argument_exception, reason=no write index is defined for alias [gsww_mjzbl_jzlgbl]. The write index may be explicitly disabled using is_write_index=false or the alias points to multiple indices without one being designated as a write index]
at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:177) ~[blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:1406) ~[blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.elasticsearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:1382) ~[blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.elasticsearch.client.RestHighLevelClient$1.onFailure(RestHighLevelClient.java:1357) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.elasticsearch.client.RestClient$FailureTrackingResponseListener.onDefinitiveFailure(RestClient.java:844) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.elasticsearch.client.RestClient$1.completed(RestClient.java:548) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.elasticsearch.client.RestClient$1.completed(RestClient.java:529) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:119) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseCompleted(DefaultClientExchangeHandlerImpl.java:177) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.processResponse(HttpAsyncRequestExecutor.java:436) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.inputReady(HttpAsyncRequestExecutor.java:326) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:265) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:588) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at java.lang.Thread.run(Thread.java:834) [?:?]
Suppressed: org.elasticsearch.client.ResponseException: method [POST], host [http://192.168.229.64:9200], URI [/_bulk?timeout=1m], status line [HTTP/1.1 400 Bad Request]
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"no write index is defined for alias [gsww_mjzbl_jzlgbl]. The write index may be explicitly disabled using is_write_index=false or the alias points to multiple indices without one being designated as a write index"}],"type":"illegal_argument_exception","reason":"no write index is defined for alias [gsww_mjzbl_jzlgbl]. The write index may be explicitly disabled using is_write_index=false or the alias points to multiple indices without one being designated as a write index"},"status":400}
at org.elasticsearch.client.RestClient$1.completed(RestClient.java:540) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.elasticsearch.client.RestClient$1.completed(RestClient.java:529) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:119) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseCompleted(DefaultClientExchangeHandlerImpl.java:177) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.processResponse(HttpAsyncRequestExecutor.java:436) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.inputReady(HttpAsyncRequestExecutor.java:326) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:265) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:588) [blob_p-ea8bfdc06b67c0436cb2f429dc7c27008aa5a6c9-04bf713032a7a4e7a3f9e6d3fdaa5f13:?]
at java.lang.Thread.run(Thread.java:834) [?:?]
原因:别名指向多个索引
指向多个索引的别名,用于执行查询不需要做额外的设置,如果需要用于执行索引操作,则需要在被指向的多个索引中指定用于执行索引操作的索引,否则报错误。
解决:我的解决办法是修改别名,每个别名指向唯一的索引,可以根据实际情况修改。