{"record":{"id":"f4e5e34afbbc14a4","repo":"risingwavelabs/risingwave","slug":"please-set-only-one-of-the-index-column-or-inde","errorCode":null,"errorMessage":"please set only one of the 'index_column' or 'index' properties.","messagePattern":"please set only one of the 'index_column' or 'index' properties\\.","errorType":"validation","errorClass":"SinkError","httpStatus":null,"severity":"error","filePath":"src/connector/src/sink/elasticsearch_opensearch/elasticsearch_opensearch_config.rs","lineNumber":253,"sourceCode":"            check_username_password()?;\n            let transport = transport_builder\n                .build()\n                .map_err(|e| SinkError::ElasticSearchOpenSearch(anyhow!(e)))?;\n            let client = opensearch::OpenSearch::new(transport);\n            Ok(ElasticSearchOpenSearchClient::OpenSearch(client))\n        } else {\n            panic!(\n                \"connector type must be {} or {}, but get {}\",\n                ES_SINK, OPENSEARCH_SINK, connector\n            );\n        }\n    }\n\n    pub fn validate_config(&self, schema: &Schema) -> Result<()> {\n        if self.index_column.is_some() && self.index.is_some()\n            || self.index_column.is_none() && self.index.is_none()\n        {\n            return Err(SinkError::Config(anyhow!(\n                \"please set only one of the 'index_column' or 'index' properties.\"\n            )));\n        }\n\n        if let Some(index_column) = &self.index_column {\n            let filed = schema\n                .fields()\n                .iter()\n                .find(|f| &f.name == index_column)\n                .unwrap();\n            if filed.data_type() != DataType::Varchar {\n                return Err(SinkError::Config(anyhow!(\n                    \"please ensure the data type of {} is varchar.\",\n                    index_column\n                )));\n            }\n        }\n","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/sink/elasticsearch_opensearch/elasticsearch_opensearch_config.rs#L235-L271","documentation":"`validate_config` enforces that an Elasticsearch/OpenSearch sink specifies its target index in exactly one way: either via the static `index` property or via the `index_column` property (a schema column whose values become the per-record index). Specifying both, or neither, is ambiguous, so the sink creation fails with this config error.","triggerScenarios":"CREATE SINK ... WITH (connector='elasticsearch', ...) where (a) both `index` and `index_column` are present in the WITH options, or (b) neither is present. Checked in `validate_config` during sink creation.","commonSituations":"Copying an example sink definition that already has `index` and adding `index_column` for dynamic indexing; or forgetting to set any index option entirely; or a config template where one of the two was commented out.","solutions":["Keep exactly one of `index` or `index_column` in the WITH clause","If you want a fixed target index, set `index` and remove `index_column`","If you want per-record dynamic index names, set `index_column` to a varchar column and remove `index`","Re-run the CREATE SINK statement after removing the redundant option"],"exampleFix":"// before\nWITH (connector = 'elasticsearch', index = 'my_index', index_column = 'topic')\n// after\nWITH (connector = 'elasticsearch', index_column = 'topic')","handlingStrategy":"validation","validationCode":"fn check_index_options(with_opts: &Options) -> Result<(), String> {\n    let has_index = with_opts.get(\"index\").is_some();\n    let has_index_column = with_opts.get(\"index_column\").is_some();\n    if has_index == has_index_column {\n        return Err(\"set exactly one of 'index' or 'index_column'\".into());\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Decide between static index and dynamic index_column before writing the sink DDL","Keep sink templates with the unused option removed, not commented out","Lint WITH options for the elasticsearch connector to require exactly one of the pair"],"tags":["rust","sink","config","elasticsearch"],"backgroundTag":"conflicting-config-options","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}