Skip to content

[BUG] Caching does not consider mode parameter for matrix-stats aggregation #18242

Closed
@jainankitk

Description

@jainankitk

Describe the bug

While working on the documentation improvements, @dwelsch-esi reported discrepancy opensearch-project/documentation-website#9434 (comment).

After spending sometime, I realized changing just the mode from avg to min or vice-versa causes same response to be returned, which is incorrect.

Related component

Search:Aggregations

To Reproduce

  1. Index few documents with multi-value fields
POST _bulk
{ "create": { "_index": "students", "_id": "1" } }
{ "name": "John Doe", "gpa": 3.89, "class_grades": [3.0, 3.9, 4.0], "grad_year": 2022}
{ "create": { "_index": "students", "_id": "2" } }
{ "name": "Jonathan Powers", "gpa": 3.85, "class_grades": [4.1, 3.0, 4.0], "grad_year": 2025 }
{ "create": { "_index": "students", "_id": "3" } }
{ "name": "Jane Doe", "gpa": 3.52, "class_grades": [3.2, 2.1, 3.8], "grad_year": 2024 }
  1. Run matrix_stats aggregation with mode as avg
GET students/_search
{
  "size": 0,
  "aggs": {
    "matrix_stats_taxful_total_price": {
      "matrix_stats": {
        "fields": ["gpa", "class_grades"],
        "mode": "avg"
      }
    }
  }
}
  1. Change mode to min, same response is returned
GET students/_search
{
  "size": 0,
  "aggs": {
    "matrix_stats_taxful_total_price": {
      "matrix_stats": {
        "fields": ["gpa", "class_grades"],
        "mode": "min"
      }
    }
  }
}

Expected behavior

The cached response should not be returned

Additional Details

Plugins
Please list all plugins currently enabled.

Screenshots
If applicable, add screenshots to help explain your problem.

Host/Environment (please complete the following information):

  • OS: [e.g. iOS]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions