{"record":{"id":"1d23e04727cf72e9","repo":"elastic/elasticsearch","slug":"error-trying-to-create-multifield-stats-results-fr","errorCode":null,"errorMessage":"Error trying to create multifield_stats results from stream input","messagePattern":"Error trying to create multifield_stats results from stream input","errorType":"exception","errorClass":"ElasticsearchException","httpStatus":null,"severity":"error","filePath":"modules/aggregations/src/main/java/org/elasticsearch/aggregations/metric/MatrixStatsResults.java","lineNumber":65,"sourceCode":"    MatrixStatsResults(RunningStats stats, SamplingContext samplingContext) {\n        this.results = stats.clone();\n        this.correlation = new HashMap<>();\n        this.compute();\n        // Note: it is important to scale counts AFTER compute as scaling before could introduce bias\n        this.results.docCount = samplingContext.scaleUp(this.results.docCount);\n        for (String field : this.results.counts.keySet()) {\n            this.results.counts.computeIfPresent(field, (k, v) -> samplingContext.scaleUp(v));\n        }\n    }\n\n    /** creates a results object from the given stream */\n    @SuppressWarnings(\"unchecked\")\n    protected MatrixStatsResults(StreamInput in) {\n        try {\n            results = new RunningStats(in);\n            correlation = (Map<String, HashMap<String, Double>>) in.readGenericValue();\n        } catch (IOException e) {\n            throw new ElasticsearchException(\"Error trying to create multifield_stats results from stream input\", e);\n        }\n    }\n\n    /** Marshalls MatrixStatsResults */\n    @Override\n    public void writeTo(StreamOutput out) throws IOException {\n        // marshall results\n        results.writeTo(out);\n        // marshall correlation\n        out.writeGenericValue(correlation);\n    }\n\n    /** return document count */\n    public final long getDocCount() {\n        return results.docCount;\n    }\n\n    /** return the field counts - not public, used for getProperty() */","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/modules/aggregations/src/main/java/org/elasticsearch/aggregations/metric/MatrixStatsResults.java#L47-L83","documentation":"Error \"Error trying to create multifield_stats results from stream input\" thrown in elastic/elasticsearch.","triggerScenarios":"Thrown at modules/aggregations/src/main/java/org/elasticsearch/aggregations/metric/MatrixStatsResults.java:65 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:17:08.281Z"}