Aggregation using execution_hit: map automatically filtered empty string key

(Ding Wang) #1

Hi guys,

I'm using execution_hint: map in my aggregation to ensure my aggs run in fast speed. However, I have a key which is "". But the aggregation result doesn't contain that bucket. I'm using terms aggregation. Do it automatically filtered by es? Anyone have encountered this problem?

(Zachary Tong) #2

When you say "", do you mean it's a blank field? Null? Or was that a space?

Elasticsearch by default treats blank and null values as if they don't exist, so nothing is indexed.

You can use null_value as a way to index placeholders for null values: Or when running the terms aggregation, you can specify a missing parameter which defines a placeholder to use when fields are missing/empty/null:

Not quite the same, but related docs on null/missing/exist here:

(Ding Wang) #4

Thank you for your reply. "" here is an empty string. The field value is an empty string. I have tried the missing value filter. It seems that it will only get the doc without the field when aggregation, not include the doc with the value"", which is an empty string.

(Ding Wang) #5

Besides, when i using execution_hint: global_ordinals. The empty value "" is kept as a bucket. But once using map as execution_hit, the "" empty value is filtered? Why? Beacuse map is aggregating using the raw value of the field?

In my application, only using map as execution_hint can satisfied the speed requirements. So I have to using that.

(system) #6

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.