Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add value_as_string to avg/min/max/sum aggregations #3081

Merged
merged 2 commits into from
Jun 6, 2024
Merged

feat: add value_as_string to avg/min/max/sum aggregations #3081

merged 2 commits into from
Jun 6, 2024

Conversation

mcenkar
Copy link
Contributor

@mcenkar mcenkar commented Jun 6, 2024

min/max aggregations return also value_as_string, which can be useful when running over date fields:

{
  "aggregations": {
    "max-example": {
      "value": 1770336000000,
      "value_as_string": "2026-02-06"
    },
    "min-example": {
      "value": 1716422400000,
      "value_as_string": "2024-05-23"
    }
  }
}

It is possible to access them now.

image

@mcenkar
Copy link
Contributor Author

mcenkar commented Jun 6, 2024

Hi @Philippus,

appreciate if you could have a look at this PR. I can also add to avg or sum aggs, it makes less sense for me over dates, but others might find it useful.

@Philippus
Copy link
Owner

It would be awesome if you could add them for avg and sum as well. Would it also be possible to add some tests?

min/max aggregations return also value_as_string, which can be useful when
running over date fields:

{
  "aggregations": {
    "max-example": {
      "value": 1770336000000,
      "value_as_string": "2026-02-06"
    },
    "min-example": {
      "value": 1716422400000,
      "value_as_string": "2024-05-23"
    }
  }
}

It is possible to access them now.
@mcenkar
Copy link
Contributor Author

mcenkar commented Jun 6, 2024

I updated PR + added some tests.

For avg and sum they are in separate tests (first, second) so more a bit more work but I can add them if you want.

(there is no value_as_string over numeric fields so would need to add date fields there as well)

image

@Philippus Philippus changed the title feat: add value_as_string to min/max aggregations feat: add value_as_string to avg/min/max/sum aggregations Jun 6, 2024
@Philippus Philippus merged commit 86b192f into Philippus:main Jun 6, 2024
3 checks passed
@Philippus
Copy link
Owner

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants