{"record":{"id":"be50dede8c21dbba","repo":"apache/seatunnel","slug":"sql-search-type-does-not-support-slicing-slice-ma-be50de","errorCode":null,"errorMessage":"SQL search_type does not support slicing. slice_max will be ignored.","messagePattern":"SQL search_type does not support slicing\\. slice_max will be ignored\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/source/ElasticsearchSourceSplitEnumerator.java","lineNumber":166,"sourceCode":"                }\n            }\n        }\n    }\n\n    private List<ElasticsearchSourceSplit> getElasticsearchSplit() {\n        List<ElasticsearchSourceSplit> splits = new ArrayList<>();\n        for (ElasticsearchConfig elasticsearchConfig : elasticsearchConfigs) {\n\n            String index = elasticsearchConfig.getIndex();\n            List<IndexDocsCount> indexDocsCounts = esRestClient.getIndexDocsCount(index);\n            indexDocsCounts =\n                    indexDocsCounts.stream()\n                            .filter(x -> x.getDocsCount() != null && x.getDocsCount() > 0)\n                            .sorted(Comparator.comparingLong(IndexDocsCount::getDocsCount))\n                            .collect(Collectors.toList());\n            int sliceMax = Math.max(1, elasticsearchConfig.getSliceMax());\n            if (SearchTypeEnum.SQL.equals(elasticsearchConfig.getSearchType()) && sliceMax > 1) {\n                log.warn(\"SQL search_type does not support slicing. slice_max will be ignored.\");\n                sliceMax = 1;\n            }\n            for (IndexDocsCount indexDocsCount : indexDocsCounts) {\n                String indexName = indexDocsCount.getIndex();\n                for (int sliceId = 0; sliceId < sliceMax; sliceId++) {\n                    ElasticsearchConfig cloneCfg = elasticsearchConfig.clone();\n                    cloneCfg.setIndex(indexName);\n                    cloneCfg.setSliceId(sliceId);\n                    cloneCfg.setSliceMax(sliceMax);\n                    String splitId = sliceMax > 1 ? indexName + \"#\" + sliceId : indexName;\n                    splits.add(new ElasticsearchSourceSplit(splitId, cloneCfg));\n                }\n            }\n        }\n        return splits;\n    }\n\n    @Override","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/source/ElasticsearchSourceSplitEnumerator.java#L148-L184","documentation":"A WARN from ElasticsearchSourceSplitEnumerator.getElasticsearchSplit: the job is configured with search_type=SQL but also sets slice_max > 1. SQL-based reads cannot be sliced, so the enumerator forces sliceMax to 1 and ignores the configured parallelism hint, producing a single split per index.","triggerScenarios":"Configuring an Elasticsearch source with search_type = SQL and slice_max greater than 1; the enumerator builds splits (via newSplits) and detects the combination.","commonSituations":"Copy-pasting config between DSL/JSON jobs that used search_type=DSL (which supports slicing) and switching to SQL without removing slice_max; users expecting parallel SQL reads for large indices.","solutions":["Remove slice_max (or set it to 1) since SQL reads cannot be sliced","Switch search_type to DSL (or the slicing-capable type) if you need multi-slice parallel reading","Verify effective parallelism after the change — with this warn, each index yields exactly one split"],"exampleFix":"// before\nsearch_type = SQL\nslice_max = 5\n// after\nsearch_type = DSL\nslice_max = 5\n// (or keep SQL and delete slice_max)","handlingStrategy":"validation","validationCode":"// validate config before submit (pseudo-check)\nif (config.search_type == \"SQL\" && (config.slice_max ?? 1) > 1) {\n  console.log(\"slice_max ignored with search_type=SQL; switch to DSL for slicing\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never combine search_type=SQL with slice_max > 1","Use search_type=DSL when index-size-based slicing/parallelism is needed","Confirm actual split count in job logs after changing search types"],"tags":["elasticsearch","config","parallelism"],"backgroundTag":"conflicting-config-options","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}