{"record":{"id":"f25897daf3dc3d67","repo":"jaegertracing/jaeger","slug":"failed-to-search-for-latest-probabilities-w","errorCode":null,"errorMessage":"failed to search for Latest Probabilities: %w","messagePattern":"failed to search for Latest Probabilities: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/v1/elasticsearch/samplingstore/storage.go","lineNumber":132,"sourceCode":"\tval := dbmodel.ProbabilitiesAndQPS{\n\t\tHostname:      hostname,\n\t\tProbabilities: probabilities,\n\t\tQPS:           qps,\n\t}\n\treturn s.writeProbabilitiesAndQPS(writeIndexName, ts, val)\n}\n\nfunc (s *SamplingStore) GetLatestProbabilities() (model.ServiceOperationProbabilities, error) {\n\tctx := context.Background()\n\tindex, err := s.getLatestIndex(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get latest index: %w\", err)\n\t}\n\tsearchResult, err := s.searcher.Search(ctx, []string{index}, esclient.SearchRequest{\n\t\tSize: s.maxDocCount,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to search for Latest Probabilities: %w\", err)\n\t}\n\tlengthOfSearchResult := len(searchResult.Hits.Hits)\n\tif lengthOfSearchResult == 0 {\n\t\treturn nil, nil\n\t}\n\n\tvar latestProbabilities dbmodel.TimeProbabilitiesAndQPS\n\tlatestTime := time.Time{}\n\tfor _, hit := range searchResult.Hits.Hits {\n\t\tvar data dbmodel.TimeProbabilitiesAndQPS\n\t\tif err = json.Unmarshal(hit.Source, &data); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unmarshalling documents failed: %w\", err)\n\t\t}\n\t\tif data.Timestamp.After(latestTime) {\n\t\t\tlatestTime = data.Timestamp\n\t\t\tlatestProbabilities = data\n\t\t}\n\t}","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/internal/storage/v1/elasticsearch/samplingstore/storage.go#L114-L150","documentation":"After resolving the latest sampling index, GetLatestProbabilities issues a Search against it; any error from the searcher is wrapped as 'failed to search for Latest Probabilities'. This indicates the Elasticsearch query itself failed at the transport or cluster level, not that results were empty (an empty result returns nil, nil).","triggerScenarios":"Calling GetLatestProbabilities when the ES cluster is unreachable, times out, rejects credentials, or rejects the search request (e.g. index deleted between existence check and search, mapping/parse error).","commonSituations":"ES node restarts or network partition mid-request; query timeout because maxDocCount is large and the cluster is loaded; security/authorization changes revoking read access to the sampling index.","solutions":["Check ES cluster health and logs for the underlying request failure; the wrapped cause names it.","Retry with backoff — transient network/timeout failures are common here.","Verify the service account has read access to the sampling index.","Reduce maxDocCount or tune ES timeouts if the search is timing out under load."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"var probs model.ServiceOperationProbabilities\nerr := retry.Do(func() error {\n  var e error\n  probs, e = store.GetLatestProbabilities()\n  return e\n}, retry.Attempts(3), retry.Backoff(time.Second))","preventionTips":["Tune ES client timeouts and maxDocCount for cluster size.","Alert on ES health before sampling reads start failing.","Verify read permissions for the sampling index."],"tags":["elasticsearch","search","network"],"backgroundTag":"search-request-failed","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}