Skip to content

MultiTerm Aggregations should support missing property #7119

Closed
@kleanthis

Description

@kleanthis

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    8.xRelates to a 8.x client version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions