# Collapse does not work if the field value is empty string

**URL:** <https://discuss.elastic.co/t/collapse-does-not-work-if-the-field-value-is-empty-string/134060>\
**Category:** Elasticsearch\
**Created:** [May 31, 2018, 1:19pm UTC](https://discuss.elastic.co/t/collapse-does-not-work-if-the-field-value-is-empty-string/134060 "2018-05-31T13:19:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ffoysal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ffoysal/32/21037_2.png) [@ffoysal](https://discuss.elastic.co/u/ffoysal)\
**Post date:** [May 31, 2018, 1:19pm UTC](https://discuss.elastic.co/t/collapse-does-not-work-if-the-field-value-is-empty-string/134060/1 "2018-05-31T13:19:51Z")

</div>

we have fields  
product\_name, product\_category.

We do collapse on product\_category. we have lots of documents that product\_category=""  
when we do collapse it collapses all the empty product\_category into one.  
The expectation is the collapse would treat all the empty product\_category is unique  
or something like conditional collapse (i.e collapse only if the product\_category is not empty)

Any idea ???

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 28, 2018, 1:19pm UTC](https://discuss.elastic.co/t/collapse-does-not-work-if-the-field-value-is-empty-string/134060/2 "2018-06-28T13:19:51Z")

</div>

Closed on June 28, 2018, 1:19pm UTC

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