You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "nihaoll (via GitHub)" <gi...@apache.org> on 2026/04/20 10:10:15 UTC

[I] [Bug] [Module Name] ElasticSearch Source Data truncate [seatunnel]

nihaoll opened a new issue, #10791:
URL: https://github.com/apache/seatunnel/issues/10791

   ### Search before asking
   
   - [x] I had searched in the [issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22bug%22) and found no similar issues.
   
   
   ### What happened
   
   I try to load data from Es to Mysql,it seems something wrong when load data from Es.
   Could you please help me with this problem? Thanks 
   
   ### SeaTunnel Version
   
   2.3.13
   
   ### SeaTunnel Config
   
   ```conf
   env {
     job.mode = "BATCH"
     execution.parallelism = 1
   }
   
   source {
     Elasticsearch {
       hosts = ["http://127.0.0.1:9200"]
       index = "business_company"
       username = "elastic"
       password = ""
   
       source = [
             "COMPANY_NAME",
             "UNIFIED_SOCIAL_CREDIT_CODE",
             "LEGAL_REPRESENTATIVE",
             "REGISTERED_CAPITAL",
             "ESTABLISHED_DATE",
             "BUSINESS_STATUS",
             "INDUSTRY",
             "BUSINESS_SCOPE",
             "REGISTERED_ADDRESS",
             "CONTACT_PHONE",
             "CONTACT_EMAIL",
             "EMPLOYEES_COUNT",
             "ANNUAL_TURNOVER",
             "CREATED_TIME",
             "UPDATED_TIME"
       ]
   
        # 可选:滚动上下文存活时间,默认1m
       scroll_time = "1m"
       
       # 可选:每次滚动请求返回的最大文档数,默认100
       scroll_size = 10
       
       connect_timeout = 5000
       socket_timeout = 60000
       max_retry_count = 3
     }
   }
   
   sink {
     jdbc {
       url = "jdbc:mysql://localhost:3306/jtool?useSSL=false&characterEncoding=utf8&serverTimezone=Asia/Shanghai"
       driver = "com.mysql.cj.jdbc.Driver"
       user = "root"
       password = ""
       
       #必须配置 query
       query = """
         INSERT INTO `jtool`.`business_company_from_es` (
           COMPANY_NAME,
           UNIFIED_SOCIAL_CREDIT_CODE,
           LEGAL_REPRESENTATIVE,
           REGISTERED_CAPITAL,
           ESTABLISHED_DATE,
           BUSINESS_STATUS,
           INDUSTRY,
           BUSINESS_SCOPE,
           REGISTERED_ADDRESS,
           CONTACT_PHONE,
           CONTACT_EMAIL,
           EMPLOYEES_COUNT,
           ANNUAL_TURNOVER,
           CREATED_TIME,
           UPDATED_TIME
         ) VALUES (
            ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
         ) ON DUPLICATE KEY UPDATE
           COMPANY_NAME = VALUES(COMPANY_NAME),
           UNIFIED_SOCIAL_CREDIT_CODE = VALUES(UNIFIED_SOCIAL_CREDIT_CODE),
           LEGAL_REPRESENTATIVE = VALUES(LEGAL_REPRESENTATIVE),
           REGISTERED_CAPITAL = VALUES(REGISTERED_CAPITAL),
           ESTABLISHED_DATE = VALUES(ESTABLISHED_DATE),
           BUSINESS_STATUS = VALUES(BUSINESS_STATUS),
           INDUSTRY = VALUES(INDUSTRY),
           BUSINESS_SCOPE = VALUES(BUSINESS_SCOPE),
           REGISTERED_ADDRESS = VALUES(REGISTERED_ADDRESS),
           CONTACT_PHONE = VALUES(CONTACT_PHONE),
           CONTACT_EMAIL = VALUES(CONTACT_EMAIL),
           EMPLOYEES_COUNT = VALUES(EMPLOYEES_COUNT),
           ANNUAL_TURNOVER = VALUES(ANNUAL_TURNOVER),
           CREATED_TIME = VALUES(CREATED_TIME),
           UPDATED_TIME = VALUES(UPDATED_TIME)
       """
       # generate_sink_sql = true
       # table = "business_company_from_es"
       # write_mode = "REPLACE"
       # primary_keys = ["ID"]
       
       # 使用自定义 query 时,不需要这些参数
       # table = "business_company_from_es"  # 注释掉
       # write_mode = "REPLACE"              # 注释掉
       # primary_keys = [...]                # 注释掉
       # field_mappings = [...]              # 注释掉
       database = "jtool"
       batch_size = 3000
       connection_check_timeout_sec = 300
       max_reconnection_times = 3
       is_exactly_once = false
     }
   }
   # sink {
   #   jdbc {
   #     url = "jdbc:mysql://localhost:3306/jtool?useSSL=false&characterEncoding=utf8&serverTimezone=Asia/Shanghai"
   #     driver = "com.mysql.cj.jdbc.Driver"
   #     user = "root"
   #     password = "486213Aa."
   
   #     #  关键:自动生成 SQL,不包含自增 ID
   #     generate_sink_sql = true
   #     table = "business_company"
   #     # 🔥 用信用代码做主键去重(ES 没有 ID,必须用这个)
   #     write_mode = "UPSERT"
   #     primary_keys = ["ID"]
   
   #     database = "jtool"
   #     batch_size = 3000
   #     connection_check_timeout_sec = 300
   #     max_reconnection_times = 3
   #     is_exactly_once = false
   #   }
   # }
   ```
   
   ### Running Command
   
   ```shell
   :: 第一步:临时设置SeaTunnel根目录(仅当前CMD窗口生效)
   chcp 65001
   
   set SEATUNNEL_HOME=E:\ProgramFiles\apache-seatunnel-2.3.13-bin\apache-seatunnel-2.3.13
   :: 第二步:直接运行(配置文件支持 相对路径/绝对路径,模式可改)
   %SEATUNNEL_HOME%\bin\seatunnel.cmd --config %cd%/config/es2mysql.conf -m local
   ```
   
   ### Error Exception
   
   ```log
   张MK","ESTABLISHED_DATE":"2017-05-14","BUSINESS_SCOPE":"计算机软硬件开发、技术咨询、销售电子产品","COMPANY_NAME":"武汉市科技公司_2331010","CONTACT_EMAIL":"contact2331010@company2331010.com","ANNUAL_TURNOVER":3208.32,"REGISTERED_CAPITAL":3093.97},"sort":[9]}]}}  
           at org.apache.seatunnel.common.utils.JsonUtils.parseObject(JsonUtils.java:274)
           at org.apache.seatunnel.common.utils.JsonUtils.parseObject(JsonUtils.java:267)
           at org.apache.seatunnel.connectors.seatunnel.elasticsearch.client.EsRestClient.getDocsFromScrollRequest(EsRestClient.java:379)
           at org.apache.seatunnel.connectors.seatunnel.elasticsearch.client.EsRestClient.searchByScroll(EsRestClient.java:234)        
           at org.apache.seatunnel.connectors.seatunnel.elasticsearch.source.ElasticsearchSourceReader.scrollSearchResult(ElasticsearchSourceReader.java:126)
           at org.apache.seatunnel.connectors.seatunnel.elasticsearch.source.ElasticsearchSourceReader.pollNext(ElasticsearchSourceReader.java:83)
           at org.apache.seatunnel.engine.server.task.flow.SourceFlowLifeCycle.collect(SourceFlowLifeCycle.java:159)
           at org.apache.seatunnel.engine.server.task.SourceSeaTunnelTask.collect(SourceSeaTunnelTask.java:127)
           at org.apache.seatunnel.engine.server.task.SeaTunnelTask.stateProcess(SeaTunnelTask.java:165)
           at org.apache.seatunnel.engine.server.task.SourceSeaTunnelTask.call(SourceSeaTunnelTask.java:132)
           at org.apache.seatunnel.engine.server.TaskExecutionService$BlockingWorker.run(TaskExecutionService.java:683)
           at org.apache.seatunnel.engine.server.TaskExecutionService$NamedTaskWrapper.run(TaskExecutionService.java:1012)
           at org.apache.seatunnel.api.tracing.MDCRunnable.run(MDCRunnable.java:43)
           at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
           at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
           at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
           at org.apache.seatunnel.shade.com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
           at org.apache.seatunnel.shade.com.fasterxml.jackson.databind.ObjectMapper._readTreeAndClose(ObjectMapper.java:4716)
           at org.apache.seatunnel.shade.com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:3090)        at org.apache.seatunnel.common.utils.JsonUtils.parseObject(JsonUtils.java:272)        ... 17 more
           at org.apache.seatunnel.core.starter.seatunnel.command.ClientExecuteCommand.execute(ClientExecuteCommand.java:258)
           ... 2 more
   2026-04-20 17:56:56,218 INFO  [s.c.s.s.c.ClientExecuteCommand] [SeaTunnel-CompletableFuture-Thread-6] - run shutdown hook because ge
   ```
   
   ### Zeta or Flink or Spark Version
   
   _No response_
   
   ### Java or Scala Version
   
   _No response_
   
   ### Screenshots
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] [Module Name] ElasticSearch Source Data truncate [seatunnel]

Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on issue #10791:
URL: https://github.com/apache/seatunnel/issues/10791#issuecomment-4289748510

   Thanks for the ES version and the complete stack. This now looks like a real charset / JSON parsing issue on the SeaTunnel side rather than a JDBC sink issue.
   
   The failing path is `EsRestClient.getDocsFromScrollRequest()`: SeaTunnel reads the ES scroll response through `EntityUtils.toString(response.getEntity())`, then calls `JsonUtils.parseObject(entity)`. The important detail is that `JsonUtils.parseObject(String)` currently calls `text.getBytes()` without an explicit charset before Jackson reads it as JSON bytes. On a JVM whose default charset is not UTF-8, a valid ES response containing Chinese text can be re-encoded into non-UTF-8 bytes, and Jackson then reports `Invalid UTF-8 middle byte`.
   
   So the likely fix should be in the JSON parsing / ES response decoding path, for example by avoiding the default-charset conversion and parsing the `String` directly, or by converting with UTF-8 explicitly.
   
   As a temporary workaround, please try running the job with a UTF-8 JVM default charset, for example by adding `-Dfile.encoding=UTF-8` to the SeaTunnel JVM options, and verify whether the same document can pass.
   
   I think the `need more information` label can be removed now because the new stack is enough to identify the likely connector-side path. Let's keep this open as a bug until the charset handling is fixed and covered by a test with non-ASCII JSON content.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] [Module Name] ElasticSearch Source Data truncate [seatunnel]

Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on issue #10791:
URL: https://github.com/apache/seatunnel/issues/10791#issuecomment-4281712910

   The failure appears to happen while the Elasticsearch source is parsing the scroll response, before the JDBC sink starts writing.
   
   The key stack frame is `EsRestClient.getDocsFromScrollRequest()`: SeaTunnel reads the ES HTTP response body and then parses it as JSON. The root error `Invalid UTF-8 middle byte` means the response bytes seen by Jackson are not valid UTF-8 JSON at that point. That could be caused by invalid bytes in one ES document, a response charset/content-encoding mismatch, or a truncated/corrupted response, but the current log is not enough to distinguish those cases.
   
   To narrow this down, could you please provide:
   
   1. Elasticsearch version and whether the index contains Chinese text encoded from a non-UTF-8 source;
   2. the full root exception, including the first `Caused by` line and the response status/header if available;
   3. a minimal ES document that reproduces the failure, with sensitive fields masked;
   4. the result of querying the same failing document through `curl` or Kibana Dev Tools to confirm whether ES returns valid JSON.
   
   Once we know whether the response itself is valid UTF-8 JSON, we can tell whether this should be handled in the connector response decoding path or in the source data/ES index cleanup path.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] [Module Name] ElasticSearch Source Data truncate [seatunnel]

Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on issue #10791:
URL: https://github.com/apache/seatunnel/issues/10791#issuecomment-4309576376

   Thanks for confirming the latest result. The fact that the job works once the JVM option is placed under `jvm_client_options` means your current runtime is unblocked, but I would still treat the underlying path as a real code-side charset bug rather than a pure usage issue.
   
   There is already a follow-up PR open at #10809 to make the JSON parsing path explicitly UTF-8 instead of relying on the platform default charset. I suggest we keep this issue open until that PR is reviewed and merged, and then move it to the fixed-in-dev path.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] [Module Name] ElasticSearch Source Data truncate [seatunnel]

Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on issue #10791:
URL: https://github.com/apache/seatunnel/issues/10791#issuecomment-4300855758

   Thanks for testing the UTF-8 JVM option. That result is useful, and I still think the issue should stay open as a connector-side charset handling bug.
   
   The fact that `-Dfile.encoding=UTF-8` did not resolve it suggests one of two things:
   
   1. the option may not have reached the actual SeaTunnel client JVM started by `seatunnel.cmd`; or
   2. the response/string conversion path still depends on a platform/default charset before JSON parsing.
   
   The code path is still the same one from the stack trace: `EsRestClient.getDocsFromScrollRequest()` reads the scroll response and then calls `JsonUtils.parseObject(entity)`. In current code, `JsonUtils.parseObject(String)` converts the string back to bytes with `text.getBytes()` without an explicit charset. That makes the behavior dependent on the JVM/platform default charset and is risky for non-ASCII JSON content.
   
   A robust fix should avoid default charset conversion in both places where possible, for example:
   
   - decode the Elasticsearch HTTP entity with an explicit UTF-8 charset; and/or
   - parse the JSON `String` directly, or convert it with `StandardCharsets.UTF_8` instead of `String#getBytes()`.
   
   Your Linux test is still helpful because it will show whether this is Windows-default-charset dependent. If you can, please also share where you added `-Dfile.encoding=UTF-8` in the 2.3.13 package, for example whether it was added to `config/jvm_client_options`. That will help confirm whether the workaround was actually applied to the SeaTunnel client process.
   
   Thanks again for narrowing this down with a minimal Chinese document. That makes the bug much easier to fix and test.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] [Module Name] ElasticSearch Source Data truncate [seatunnel]

Posted by "nihaoll (via GitHub)" <gi...@apache.org>.
nihaoll commented on issue #10791:
URL: https://github.com/apache/seatunnel/issues/10791#issuecomment-4293572294

   Thanks for the detailed analysis.
   
   I tried adding -Dfile.encoding=UTF-8 to the SeaTunnel JVM options, but unfortunately the issue still persists. The same Invalid UTF-8 middle byte error continues to occur when processing the same document containing Chinese text. 
   
   I will continue this test on a Linux System and see if this problem could be avoided. 
   
   Thanks again,and hope it resolved in the future and if there is anything I could do,please tell me.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] [Module Name] ElasticSearch Source Data truncate [seatunnel]

Posted by "dybyte (via GitHub)" <gi...@apache.org>.
dybyte closed issue #10791: [Bug] [Module Name] ElasticSearch Source Data truncate
URL: https://github.com/apache/seatunnel/issues/10791


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] [Module Name] ElasticSearch Source Data truncate [seatunnel]

Posted by "nihaoll (via GitHub)" <gi...@apache.org>.
nihaoll commented on issue #10791:
URL: https://github.com/apache/seatunnel/issues/10791#issuecomment-4279769308

   more errors:
   Caused by: org.apache.seatunnel.shade.com.fasterxml.jackson.core.JsonParseException: Invalid UTF-8 middle byte 0xcc
    at [Source: (byte[])"{"_scroll_id":"FGluY2x1ZGVfY29udGV4dF91dWlkDXF1ZXJ5QW5kRmV0Y2gBFnAzU2Vvd0lSUm1xRjA2c2ZITXF0SmcAAAAAAABW-RZBdWNURFFwa1JlaUpBRW11UTFHdktB","took":4,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":{"value":4026015,"relation":"eq"},"max_score":null,"hits":[{"_index":"business_company","_id":"91000000002331001","_score":null,"_source":{"CREATED_TIME":"2026-04-18T15:30:51","UPDATED_TIME":"2026-04-18T15:30:51","INDUSTRY":"????????","BUSINESS_STATUS":"???"[truncated 6080 bytes]; line: 1, column: 468]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] [Module Name] ElasticSearch Source Data truncate [seatunnel]

Posted by "nihaoll (via GitHub)" <gi...@apache.org>.
nihaoll commented on issue #10791:
URL: https://github.com/apache/seatunnel/issues/10791#issuecomment-4286499017

   I refine another index and write a document contains chinese using kibana,but the question still exists and here is the complete error stack
   
   `2026-04-21 14:50:40,855 ERROR [o.a.s.c.s.SeaTunnel           ] [main] - Exception StackTrace:org.apache.seatunnel.core.starter.exception.CommandExecuteException: SeaTunnel job executed failed
           at org.apache.seatunnel.core.starter.seatunnel.command.ClientExecuteCommand.execute(ClientExecuteCommand.java:266)
           at org.apache.seatunnel.core.starter.SeaTunnel.run(SeaTunnel.java:40)
           at org.apache.seatunnel.core.starter.seatunnel.SeaTunnelClient.main(SeaTunnelClient.java:40)
   Caused by: org.apache.seatunnel.engine.common.exception.SeaTunnelEngineException: java.lang.RuntimeException: String json deserialization exception.{"_scroll_id":"FGluY2x1ZGVfY29udGV4dF91dWlkDXF1ZXJ5QW5kRmV0Y2gBFkI3TDhvWlV3UVlPX3NqRWNYYU1SZlEAAAAAAAA2sBZBdWNURFFwa1JlaUpBRW11UTFHdktB","took":37,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":{"value":1,"relation":"eq"},"max_score":null,"hits":[{"_index":"test_chinese_index","_id":"1","_score":null,"_source":{"company_name":"乐"},"sort":[0]}]}}
           at org.apache.seatunnel.common.utils.JsonUtils.parseObject(JsonUtils.java:274)
           at org.apache.seatunnel.common.utils.JsonUtils.parseObject(JsonUtils.java:267)
           at org.apache.seatunnel.connectors.seatunnel.elasticsearch.client.EsRestClient.getDocsFromScrollRequest(EsRestClient.java:379)
           at org.apache.seatunnel.connectors.seatunnel.elasticsearch.client.EsRestClient.searchByScroll(EsRestClient.java:234)        
           at org.apache.seatunnel.connectors.seatunnel.elasticsearch.source.ElasticsearchSourceReader.scrollSearchResult(ElasticsearchSourceReader.java:126)
           at org.apache.seatunnel.connectors.seatunnel.elasticsearch.source.ElasticsearchSourceReader.pollNext(ElasticsearchSourceReader.java:83)
           at org.apache.seatunnel.engine.server.task.flow.SourceFlowLifeCycle.collect(SourceFlowLifeCycle.java:159)
           at org.apache.seatunnel.engine.server.task.SourceSeaTunnelTask.collect(SourceSeaTunnelTask.java:127)
           at org.apache.seatunnel.engine.server.task.SeaTunnelTask.stateProcess(SeaTunnelTask.java:165)
           at org.apache.seatunnel.engine.server.task.SourceSeaTunnelTask.call(SourceSeaTunnelTask.java:132)
           at org.apache.seatunnel.engine.server.TaskExecutionService$BlockingWorker.run(TaskExecutionService.java:683)
           at org.apache.seatunnel.engine.server.TaskExecutionService$NamedTaskWrapper.run(TaskExecutionService.java:1012)
           at org.apache.seatunnel.api.tracing.MDCRunnable.run(MDCRunnable.java:43)
           at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
           at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
           at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
           at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
           at java.base/java.lang.Thread.run(Thread.java:842)
   Caused by: org.apache.seatunnel.shade.com.fasterxml.jackson.core.JsonParseException: Invalid UTF-8 middle byte 0xd6
    at [Source: (byte[])"{"_scroll_id":"FGluY2x1ZGVfY29udGV4dF91dWlkDXF1ZXJ5QW5kRmV0Y2gBFkI3TDhvWlV3UVlPX3NqRWNYYU1SZlEAAAAAAAA2sBZBdWNURFFwa1JlaUpBRW11UTFHdktB","took":37,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":{"value":1,"relation":"eq"},"max_score":null,"hits":[{"_index":"test_chinese_index","_id":"1","_score":null,"_source":{"company_name":"??"},"sort":[0]}]}}"; line: 1, column: 379]
           at org.apache.seatunnel.shade.com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:2391)
           at org.apache.seatunnel.shade.com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:735)    
           at org.apache.seatunnel.shade.com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidOther(UTF8StreamJsonParser.java:3652)
           at org.apache.seatunnel.shade.com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidOther(UTF8StreamJsonParser.java:3659)
           at org.apache.seatunnel.shade.com.fasterxml.jackson.core.json.UTF8StreamJsonParser._decodeUtf8_2(UTF8StreamJsonParser.java:3433)
           at org.apache.seatunnel.shade.com.fasterxml.jackson.core.json.UTF8StreamJsonParser._finishString2(UTF8StreamJsonParser.java:2555)
           at org.apache.seatunnel.shade.com.fasterxml.jackson.core.json.UTF8StreamJsonParser._finishAndReturnString(UTF8StreamJsonParser.java:2507)
           at org.apache.seatunnel.shade.com.fasterxml.jackson.core.json.UTF8StreamJsonParser.getText(UTF8StreamJsonParser.java:334)   
           at org.apache.seatunnel.shade.com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer._deserializeContainerNoRecursion(JsonNodeDeserializer.java:473)
           at org.apache.seatunnel.shade.com.fasterxml.jackson.databind.deser.std.JsonNodeDeserializer.deserialize(JsonNodeDeserializer.java:84)
           at org.apache.seatunnel.shade.com.fasterxml.jackson.databind.deser.std.JsonNodeDeserializer.deserialize(JsonNodeDeserializer.java:20)
           at org.apache.seatunnel.shade.com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
           at org.apache.seatunnel.shade.com.fasterxml.jackson.databind.ObjectMapper._readTreeAndClose(ObjectMapper.java:4716)
           at org.apache.seatunnel.shade.com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:3090)
           at org.apache.seatunnel.common.utils.JsonUtils.parseObject(JsonUtils.java:272)
           ... 17 more
   
           at org.apache.seatunnel.core.starter.seatunnel.command.ClientExecuteCommand.execute(ClientExecuteCommand.java:258)
           ... 2 more
   
   2026-04-21 14:50:40,858 ERROR [o.a.s.c.s.SeaTunnel           ] [main] -
   ===============================================================================
   
   
   
   Exception in thread "main" org.apache.seatunnel.core.starter.exception.CommandExecuteException: SeaTunnel job executed failed       
           at org.apache.seatunnel.core.starter.seatunnel.command.ClientExecuteCommand.execute(ClientExecuteCommand.java:266)
           at org.apache.seatunnel.core.starter.SeaTunnel.run(SeaTunnel.java:40)
           at org.apache.seatunnel.core.starter.seatunnel.SeaTunnelClient.main(SeaTunnelClient.java:40)
   Caused by: org.apache.seatunnel.engine.common.exception.SeaTunnelEngineException: java.lang.RuntimeException: String json deserialization exception.{"_scroll_id":"FGluY2x1ZGVfY29udGV4dF91dWlkDXF1ZXJ5QW5kRmV0Y2gBFkI3TDhvWlV3UVlPX3NqRWNYYU1SZlEAAAAAAAA2sBZBdWNURFFwa1JlaUpBRW11UTFHdktB","took":37,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":{"value":1,"relation":"eq"},"max_score":null,"hits":[{"_index":"test_chinese_index","_id":"1","_score":null,"_source":{"company_name":"乐"},"sort":[0]}]}}
           at org.apache.seatunnel.common.utils.JsonUtils.parseObject(JsonUtils.java:274)
           at org.apache.seatunnel.common.utils.JsonUtils.parseObject(JsonUtils.java:267)
           at org.apache.seatunnel.connectors.seatunnel.elasticsearch.client.EsRestClient.getDocsFromScrollRequest(EsRestClient.java:379)
           at org.apache.seatunnel.connectors.seatunnel.elasticsearch.client.EsRestClient.searchByScroll(EsRestClient.java:234)        
           at org.apache.seatunnel.connectors.seatunnel.elasticsearch.source.ElasticsearchSourceReader.scrollSearchResult(ElasticsearchSourceReader.java:126)
           at org.apache.seatunnel.connectors.seatunnel.elasticsearch.source.ElasticsearchSourceReader.pollNext(ElasticsearchSourceReader.java:83)
           at org.apache.seatunnel.engine.server.task.flow.SourceFlowLifeCycle.collect(SourceFlowLifeCycle.java:159)
           at org.apache.seatunnel.engine.server.task.SourceSeaTunnelTask.collect(SourceSeaTunnelTask.java:127)
           at org.apache.seatunnel.engine.server.task.SeaTunnelTask.stateProcess(SeaTunnelTask.java:165)
           at org.apache.seatunnel.engine.server.task.SourceSeaTunnelTask.call(SourceSeaTunnelTask.java:132)
           at org.apache.seatunnel.engine.server.TaskExecutionService$BlockingWorker.run(TaskExecutionService.java:683)
           at org.apache.seatunnel.engine.server.TaskExecutionService$NamedTaskWrapper.run(TaskExecutionService.java:1012)
           at org.apache.seatunnel.api.tracing.MDCRunnable.run(MDCRunnable.java:43)
           at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
           at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
           at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
           at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
           at java.base/java.lang.Thread.run(Thread.java:842)
   Caused by: org.apache.seatunnel.shade.com.fasterxml.jackson.core.JsonParseException: Invalid UTF-8 middle byte 0xd6
    at [Source: (byte[])"{"_scroll_id":"FGluY2x1ZGVfY29udGV4dF91dWlkDXF1ZXJ5QW5kRmV0Y2gBFkI3TDhvWlV3UVlPX3NqRWNYYU1SZlEAAAAAAAA2sBZBdWNURFFwa1JlaUpBRW11UTFHdktB","took":37,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":{"value":1,"relation":"eq"},"max_score":null,"hits":[{"_index":"test_chinese_index","_id":"1","_score":null,"_source":{"company_name":"??"},"sort":[0]}]}}"; line: 1, column: 379]
           at org.apache.seatunnel.shade.com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:2391)
           at org.apache.seatunnel.shade.com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:735)    
           at org.apache.seatunnel.shade.com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidOther(UTF8StreamJsonParser.java:3652)
           at org.apache.seatunnel.shade.com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidOther(UTF8StreamJsonParser.java:3659)
           at org.apache.seatunnel.shade.com.fasterxml.jackson.core.json.UTF8StreamJsonParser._decodeUtf8_2(UTF8StreamJsonParser.java:3433)
           at org.apache.seatunnel.shade.com.fasterxml.jackson.core.json.UTF8StreamJsonParser._finishString2(UTF8StreamJsonParser.java:2555)
           at org.apache.seatunnel.shade.com.fasterxml.jackson.core.json.UTF8StreamJsonParser._finishAndReturnString(UTF8StreamJsonParser.java:2507)
           at org.apache.seatunnel.shade.com.fasterxml.jackson.core.json.UTF8StreamJsonParser.getText(UTF8StreamJsonParser.java:334)   
           at org.apache.seatunnel.shade.com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer._deserializeContainerNoRecursion(JsonNodeDeserializer.java:473)
           at org.apache.seatunnel.shade.com.fasterxml.jackson.databind.deser.std.JsonNodeDeserializer.deserialize(JsonNodeDeserializer.java:84)
           at org.apache.seatunnel.shade.com.fasterxml.jackson.databind.deser.std.JsonNodeDeserializer.deserialize(JsonNodeDeserializer.java:20)
           at org.apache.seatunnel.shade.com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
           at org.apache.seatunnel.shade.com.fasterxml.jackson.databind.ObjectMapper._readTreeAndClose(ObjectMapper.java:4716)
           at org.apache.seatunnel.shade.com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:3090)
           at org.apache.seatunnel.common.utils.JsonUtils.parseObject(JsonUtils.java:272)
           ... 17 more
   
           at org.apache.seatunnel.core.starter.seatunnel.command.ClientExecuteCommand.execute(ClientExecuteCommand.java:258)
           ... 2 more
   2026-04-21 14:50:40,862 INFO  [s.c.s.s.c.ClientExecuteCommand] [SeaTunnel-CompletableFuture-Thread-7] - run shutdown hook because get close signal`
   
   
   this is the new conf:
   
   `env {
     job.mode = "BATCH"
     execution.parallelism = 1
   }
   
   source {
     Elasticsearch {
       hosts = ["http://127.0.0.1:9200"]
       index = "test_chinese_index"
       username = "elastic"
       password = "486213Aa."
   
       source = [
         # "company_name",
         "company_name"
             # "INDUSTRY",
             # "BUSINESS_SCOPE",
             # "REGISTERED_ADDRESS",
             # "CONTACT_PHONE",
             # "CONTACT_EMAIL",
             # "EMPLOYEES_COUNT",
             # "ANNUAL_TURNOVER",
             # "CREATED_TIME",
             # "UPDATED_TIME"
       ]
   
        # 可选:滚动上下文存活时间,默认1m
       scroll_time = "1m"
       
       # 可选:每次滚动请求返回的最大文档数,默认100
       scroll_size = 10
       
       connect_timeout = 5000
       socket_timeout = 60000
       max_retry_count = 3
     }
   }
   
   
   
   # sink {
   #   Console {
   #     # 可选:打印结果的数量限制,默认打印所有
   #     limit = 100
       
   #     # 可选:数据序列化格式,可选 "json" 或 "plain"
   #     data_format = "json"
   #   }
   # }
   sink {
     jdbc {
       url = "jdbc:mysql://localhost:3306/jtool?useSSL=false&characterEncoding=utf8&serverTimezone=Asia/Shanghai"
       driver = "com.mysql.cj.jdbc.Driver"
       user = "root"
       password = "486213Aa."
       
       #必须配置 query
       # query = """
       #   INSERT INTO `jtool`.`business_company_from_es` (
       #     COMPANY_NAME,
       #     UNIFIED_SOCIAL_CREDIT_CODE,
       #     LEGAL_REPRESENTATIVE,
       #     REGISTERED_CAPITAL,
       #     ESTABLISHED_DATE,
       #     BUSINESS_STATUS,
       #     INDUSTRY,
       #     BUSINESS_SCOPE,
       #     REGISTERED_ADDRESS,
       #     CONTACT_PHONE,
       #     CONTACT_EMAIL,
       #     EMPLOYEES_COUNT,
       #     ANNUAL_TURNOVER,
       #     CREATED_TIME,
       #     UPDATED_TIME
       #   ) VALUES (
       #      ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
       #   ) ON DUPLICATE KEY UPDATE
       #     COMPANY_NAME = VALUES(COMPANY_NAME),
       #     UNIFIED_SOCIAL_CREDIT_CODE = VALUES(UNIFIED_SOCIAL_CREDIT_CODE),
       #     LEGAL_REPRESENTATIVE = VALUES(LEGAL_REPRESENTATIVE),
       #     REGISTERED_CAPITAL = VALUES(REGISTERED_CAPITAL),
       #     ESTABLISHED_DATE = VALUES(ESTABLISHED_DATE),
       #     BUSINESS_STATUS = VALUES(BUSINESS_STATUS),
       #     INDUSTRY = VALUES(INDUSTRY),
       #     BUSINESS_SCOPE = VALUES(BUSINESS_SCOPE),
       #     REGISTERED_ADDRESS = VALUES(REGISTERED_ADDRESS),
       #     CONTACT_PHONE = VALUES(CONTACT_PHONE),
       #     CONTACT_EMAIL = VALUES(CONTACT_EMAIL),
       #     EMPLOYEES_COUNT = VALUES(EMPLOYEES_COUNT),
       #     ANNUAL_TURNOVER = VALUES(ANNUAL_TURNOVER),
       #     CREATED_TIME = VALUES(CREATED_TIME),
       #     UPDATED_TIME = VALUES(UPDATED_TIME)
       # """
       query = """
         INSERT INTO `jtool`.`business_company_from_es` (
           COMPANY_NAME
         ) VALUES (
            ?
         ) 
       """
       # generate_sink_sql = true
       # table = "business_company_from_es"
       # write_mode = "REPLACE"
       # primary_keys = ["ID"]
       
       # 使用自定义 query 时,不需要这些参数
       # table = "business_company_from_es"  # 注释掉
       # write_mode = "REPLACE"              # 注释掉
       # primary_keys = [...]                # 注释掉
       # field_mappings = [...]              # 注释掉
       database = "jtool"
       batch_size = 3000
       connection_check_timeout_sec = 300
       max_reconnection_times = 3
       is_exactly_once = false
     }
   }
   
   
   # sink {
   #   jdbc {
   #     url = "jdbc:mysql://localhost:3306/jtool?useSSL=false&characterEncoding=utf8&serverTimezone=Asia/Shanghai"
   #     driver = "com.mysql.cj.jdbc.Driver"
   #     user = "root"
   #     password = "486213Aa."
   
   #     #  关键:自动生成 SQL,不包含自增 ID
   #     generate_sink_sql = true
   #     table = "business_company"
   #     # 🔥 用信用代码做主键去重(ES 没有 ID,必须用这个)
   #     write_mode = "UPSERT"
   #     primary_keys = ["ID"]
   
   #     database = "jtool"
   #     batch_size = 3000
   #     connection_check_timeout_sec = 300
   #     max_reconnection_times = 3
   #     is_exactly_once = false
   #   }
   # }`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] [Module Name] ElasticSearch Source Data truncate [seatunnel]

Posted by "nihaoll (via GitHub)" <gi...@apache.org>.
nihaoll commented on issue #10791:
URL: https://github.com/apache/seatunnel/issues/10791#issuecomment-4309068414

   Thank you so so much, this problem has been resolved according to your more detailed guide.
   I incorrectly added the jvm params in the conf ` jvm_options ` rather than `jvm_client_options`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] [Module Name] ElasticSearch Source Data truncate [seatunnel]

Posted by "CosmosNi (via GitHub)" <gi...@apache.org>.
CosmosNi commented on issue #10791:
URL: https://github.com/apache/seatunnel/issues/10791#issuecomment-4302732952

   The root cause is presumably that the Chinese characters stored in Elasticsearch are encoded in GBK or GB2312, rather than standard UTF-8.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org