{"record":{"id":"93f882d1f807e6e8","repo":"risingwavelabs/risingwave","slug":"cannot-find","errorCode":null,"errorMessage":"Cannot find {}","messagePattern":"Cannot find (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/connector/src/sink/elasticsearch_opensearch/elasticsearch_converter.rs","lineNumber":53,"sourceCode":"}\nimpl StreamChunkConverter {\n    pub fn new(\n        sink_name: &str,\n        schema: Schema,\n        pk_indices: &Vec<usize>,\n        properties: &BTreeMap<String, String>,\n        is_append_only: bool,\n    ) -> Result<Self> {\n        if is_remote_es_sink(sink_name) {\n            let index_column = properties\n                .get(ES_OPTION_INDEX_COLUMN)\n                .cloned()\n                .map(|n| {\n                    schema\n                        .fields()\n                        .iter()\n                        .position(|s| s.name == n)\n                        .ok_or_else(|| anyhow!(\"Cannot find {}\", ES_OPTION_INDEX_COLUMN))\n                })\n                .transpose()?;\n            let index = properties.get(ES_OPTION_INDEX).cloned();\n            let routing_column = properties\n                .get(ES_OPTION_ROUTING_COLUMN)\n                .cloned()\n                .map(|n| {\n                    schema\n                        .fields()\n                        .iter()\n                        .position(|s| s.name == n)\n                        .ok_or_else(|| anyhow!(\"Cannot find {}\", ES_OPTION_ROUTING_COLUMN))\n                })\n                .transpose()?;\n            Ok(StreamChunkConverter::Es(EsStreamChunkConverter::new(\n                schema,\n                pk_indices.clone(),\n                properties.get(ES_OPTION_DELIMITER).cloned(),","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/sink/elasticsearch_opensearch/elasticsearch_converter.rs#L35-L71","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nCREATE SINK es_sink FROM mv WITH (\n  'connector' = 'elasticsearch',\n  'url' = 'http://localhost:9200',\n  'primary_key' = 'usr_id'\n)\n// after\nCREATE SINK es_sink FROM mv WITH (\n  'connector' = 'elasticsearch',\n  'url' = 'http://localhost:9200',\n  'primary_key' = 'user_id'\n)","handlingStrategy":"validation","validationCode":"-- run before creating the sink\nDESCRIBE my_mv;  -- confirm 'primary_key' names an existing column\n-- option must be set and match a schema column exactly","typeGuard":null,"tryCatchPattern":"match err { SinkError::ElasticSearchOpenSearch(e) if e.to_string().starts_with(\"Cannot find\") => fix_and_recreate_sink_with_valid_primary_key(), _ => return Err(err) }","preventionTips":["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."],"tags":["elasticsearch","opensearch","sink","config","schema"],"backgroundTag":"missing-required-config-field","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"}