risingwavelabs/risingwave · error · SinkError
please set only one of the 'index_column' or 'index' propert
Error message
please set only one of the 'index_column' or 'index' properties.
What it means
`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.
Source
Thrown at src/connector/src/sink/elasticsearch_opensearch/elasticsearch_opensearch_config.rs:253
check_username_password()?;
let transport = transport_builder
.build()
.map_err(|e| SinkError::ElasticSearchOpenSearch(anyhow!(e)))?;
let client = opensearch::OpenSearch::new(transport);
Ok(ElasticSearchOpenSearchClient::OpenSearch(client))
} else {
panic!(
"connector type must be {} or {}, but get {}",
ES_SINK, OPENSEARCH_SINK, connector
);
}
}
pub fn validate_config(&self, schema: &Schema) -> Result<()> {
if self.index_column.is_some() && self.index.is_some()
|| self.index_column.is_none() && self.index.is_none()
{
return Err(SinkError::Config(anyhow!(
"please set only one of the 'index_column' or 'index' properties."
)));
}
if let Some(index_column) = &self.index_column {
let filed = schema
.fields()
.iter()
.find(|f| &f.name == index_column)
.unwrap();
if filed.data_type() != DataType::Varchar {
return Err(SinkError::Config(anyhow!(
"please ensure the data type of {} is varchar.",
index_column
)));
}
}
View on GitHub (pinned to 6469eb736d)
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
Example fix
// before WITH (connector = 'elasticsearch', index = 'my_index', index_column = 'topic') // after WITH (connector = 'elasticsearch', index_column = 'topic')
Defensive patterns
Strategy: validation
Validate before calling
fn check_index_options(with_opts: &Options) -> Result<(), String> {
let has_index = with_opts.get("index").is_some();
let has_index_column = with_opts.get("index_column").is_some();
if has_index == has_index_column {
return Err("set exactly one of 'index' or 'index_column'".into());
}
Ok(())
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- please ensure the data type of {} is varchar.
- Cannot find {}
- `{}` must be {}, or {}
- Primary key not defined for upsert doris sink (please define
- Can't get fe host from url
AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11).
Data as JSON: /api/errors/f4e5e34afbbc14a4.
Report an issue: GitHub.