{"record":{"id":"4733402bebd68d6e","repo":"jaegertracing/jaeger","slug":"unsupported-es-version-d-expected-7-8-9-ela","errorCode":null,"errorMessage":"unsupported --es-version %d: expected 7, 8, 9 (Elasticsearch) or 101, 102, 103 (OpenSearch); prefer --backend","messagePattern":"unsupported --es-version (.+?): expected 7, 8, 9 \\(Elasticsearch\\) or 101, 102, 103 \\(OpenSearch\\); prefer --backend","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/elasticsearch/mappings/flags.go","lineNumber":37,"sourceCode":"\tReplicas      *int64\n\tIndexPrefix   string\n\tUseILM        string // using string as util is being used in python and using bool leads to type issues.\n\tILMPolicyName string\n}\n\n// resolveBackendVersion selects the backend version from the generator's two\n// version flags. The distribution-aware --backend token (\"es8\", \"os3\") wins when\n// set; otherwise the legacy numeric --es-version is used. The legacy flag still\n// accepts OpenSearch codes (101-103) for backward compatibility — --backend is\n// just the readable spelling — so the number is validated against the supported\n// set rather than cast blindly (an unsupported value like 999 would otherwise be\n// misread as OpenSearch, since IsOpenSearch is >= 101).\nfunc resolveBackendVersion(backendToken string, legacyEsVersion uint) (es.BackendVersion, error) {\n\tif backendToken != \"\" {\n\t\treturn es.ParseBackendVersion(backendToken)\n\t}\n\tif !es.IsSupportedVersion(legacyEsVersion) {\n\t\treturn 0, fmt.Errorf(\"unsupported --es-version %d: expected 7, 8, 9 (Elasticsearch) or 101, 102, 103 (OpenSearch); prefer --backend\", legacyEsVersion)\n\t}\n\treturn es.BackendVersion(legacyEsVersion), nil\n}\n\nconst (\n\tmappingFlag       = \"mapping\"\n\tbackendFlag       = \"backend\"\n\tesVersionFlag     = \"es-version\"\n\tshardsFlag        = \"shards\"\n\treplicasFlag      = \"replicas\"\n\tindexPrefixFlag   = \"index-prefix\"\n\tuseILMFlag        = \"use-ilm\"\n\tilmPolicyNameFlag = \"ilm-policy-name\"\n)\n\n// AddFlags adds flags for esmapping-generator main program\nfunc (o *Options) AddFlags(command *cobra.Command) {\n\tcommand.Flags().StringVar(","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/internal/storage/elasticsearch/mappings/flags.go#L19-L55","documentation":"resolveBackendVersion maps the legacy --es-version numeric flag to a BackendVersion. When no --backend token is given and the numeric value is not one of the supported Elasticsearch (7, 8, 9) or OpenSearch (101, 102, 103) codes, the tool refuses to guess (values < 101 could otherwise be misread as OpenSearch) and returns this error, suggesting the newer --backend flag.","triggerScenarios":"Running the mapping command with --es-version set to anything other than 7/8/9/101/102/103 — e.g. --es-version=6, --es-version=0, or --es-version=8.x — while --backend is empty.","commonSituations":"Migrating from Jaeger 1.x where ES 6 was supported; scripts defaulting the flag to 0; operators not realizing OpenSearch uses 101-103 codes; ES 10-style values.","solutions":["Prefer --backend=elasticsearch or --backend=opensearch and drop --es-version entirely.","If keeping --es-version, set it to 7, 8, or 9 for Elasticsearch or 101, 102, 103 for OpenSearch 1.x/2.x/3.x respectively.","Update deployment manifests/Helm values that pin the legacy flag."],"exampleFix":"// before\n--es-version=6\n// after\n--backend=elasticsearch --es-version=7","handlingStrategy":"validation","validationCode":"supported := map[uint]bool{7: true, 8: true, 9: true, 101: true, 102: true, 103: true}\nif !supported[esVersion] {\n  return fmt.Errorf(\"--es-version=%d unsupported\", esVersion)\n}","typeGuard":"func isSupportedLegacyVersion(v uint) bool {\n  return v == 7 || v == 8 || v == 9 || v == 101 || v == 102 || v == 103\n}","tryCatchPattern":"bv, err := resolveBackendVersion(backend, esVersion)\nif err != nil {\n  log.Fatalf(\"bad version flags: %v — set --backend=elasticsearch|opensearch\", err)\n}","preventionTips":["Use --backend=elasticsearch|opensearch and avoid the legacy --es-version flag.","Default --es-version to a supported value (e.g. 7) rather than 0 in scripts.","Check --help or es.IsSupportedVersion before upgrading/deploying."],"tags":["cli","validation","versioning","opensearch"],"backgroundTag":"unsupported-version","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}