risingwavelabs/risingwave · error
Cannot find {}
Error message
Cannot find {} What it means
Raised in ElasticsearchStreamChunkConverter::new when the user-supplied `primary_key` option names a column that does not exist in the sink's schema, or the option is required but absent. The converter must map the index (document id) column to a schema field position and cannot proceed without it.
Source
Thrown at src/connector/src/sink/elasticsearch_opensearch/elasticsearch_converter.rs:53
}
impl StreamChunkConverter {
pub fn new(
sink_name: &str,
schema: Schema,
pk_indices: &Vec<usize>,
properties: &BTreeMap<String, String>,
is_append_only: bool,
) -> Result<Self> {
if is_remote_es_sink(sink_name) {
let index_column = properties
.get(ES_OPTION_INDEX_COLUMN)
.cloned()
.map(|n| {
schema
.fields()
.iter()
.position(|s| s.name == n)
.ok_or_else(|| anyhow!("Cannot find {}", ES_OPTION_INDEX_COLUMN))
})
.transpose()?;
let index = properties.get(ES_OPTION_INDEX).cloned();
let routing_column = properties
.get(ES_OPTION_ROUTING_COLUMN)
.cloned()
.map(|n| {
schema
.fields()
.iter()
.position(|s| s.name == n)
.ok_or_else(|| anyhow!("Cannot find {}", ES_OPTION_ROUTING_COLUMN))
})
.transpose()?;
Ok(StreamChunkConverter::Es(EsStreamChunkConverter::new(
schema,
pk_indices.clone(),
properties.get(ES_OPTION_DELIMITER).cloned(),View on GitHub (pinned to 6469eb736d)
Solutions
- Set `primary_key` in the sink WITH options to an existing column of the source materialized view.
- Check column names with `DESCRIBE <mv>` and fix case/typo mismatches.
- Recreate or alter the sink after any upstream column renames.
Example fix
// before CREATE SINK es_sink FROM mv WITH ( 'connector' = 'elasticsearch', 'url' = 'http://localhost:9200', 'primary_key' = 'usr_id' ) // after CREATE SINK es_sink FROM mv WITH ( 'connector' = 'elasticsearch', 'url' = 'http://localhost:9200', 'primary_key' = 'user_id' )
Defensive patterns
Strategy: validation
Validate before calling
-- run before creating the sink DESCRIBE my_mv; -- confirm 'primary_key' names an existing column -- option must be set and match a schema column exactly
Try / catch
match err { SinkError::ElasticSearchOpenSearch(e) if e.to_string().starts_with("Cannot find") => fix_and_recreate_sink_with_valid_primary_key(), _ => return Err(err) } Prevention
- DESCRIBE the source relation and copy column names verbatim into primary_key.
- Never hard-code column names in templates; generate sink DDL from the schema.
- Re-validate sink options after any upstream schema migration.
When it happens
Trigger: Creating an Elasticsearch/OpenSearch sink with a `primary_key` (ES_OPTION_PRIMARY_KEY) property that doesn't match any column name in the materialized view's schema, or setting it to an empty/missing value that resolves to no field.
Common situations: Typo in the primary_key option; renaming a column upstream without updating the sink definition; omitting primary_key when it's mandatory for the chosen index setup.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- Cannot find {}
- send bulk to elasticsearch failed: {:?}
- Invalid field: {}, allowed fields: {:?}
- please set the password when the username is set.
- please set the username when the password is set.
AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11).
Data as JSON: /api/errors/93f882d1f807e6e8.
Report an issue: GitHub.