Skip to content

MultiTerm Aggregations should support missing property #7119

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

Closed
kleanthis opened this issue Dec 19, 2022 · 1 comment · Fixed by #7146
Closed

MultiTerm Aggregations should support missing property #7119

kleanthis opened this issue Dec 19, 2022 · 1 comment · Fixed by #7146
Labels
8.x Relates to a 8.x client version

Comments

@kleanthis
Copy link

kleanthis commented Dec 19, 2022

Elastic.Clients.Elasticsearch version:
8.0.3

Elasticsearch version:
8.5.2

.NET runtime version:

$ dotnet --version
7.0.100

Operating system version:
macOS Ventura 13.0.1 (22A400)

Description of the problem including expected versus actual behavior:
Consider the following:

GET /some_index/_search
{
  "query": {
    ... (doesn't matter)
  },
  "size": 0,
  "aggs": {
    "some_name": {
      "multi_terms": {
        "terms": [
          {
            "field": "some_field"
          },
          {
            "field": "another_field", "missing": "-"
          }
        ]
      }
    }
  }
}

It is possible, and desirable, to supply a value when the field is missing its value, so it can be included in the aggregation as very wisely the folks of the engine have provided (see docs)

It is not obvious to me how we can specify this using the 8.x client and using MultiTermLookup/MultiTermLookupDescriptor. It appears to only support Field.

Expected behavior
There should be a way to supply a missing property for each term, e.g. by adding a Missing property on MultiTermLookup.

I suspect there will be a challenge with the type of said Missing property (or it could be infered from the type of the Field). In my opinion, this is a challenge for strongly typed clients anyway since the bucket response looks like this:

{
  "key": [
    "life",
    42
  ],
  "key_as_string": "life|42",
  "doc_count": xx
},

I am not trying to get into how it should be implemented, but personally, I find multi_terms extremely useful so I will take anything as a stop-gap solution rather than not being able to it at all.

@stevejgordon
Copy link
Contributor

Thanks for highlighting this, @kleanthis. This is missing from the specification and therefore not generated. I have submitted a PR to address this and we'll be able to include it in a future release of the client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.x Relates to a 8.x client version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants