# Facet aggregate real OR condition

**URL:** <https://discuss.elastic.co/t/facet-aggregate-real-or-condition/190940>\
**Category:** Elasticsearch\
**Created:** [July 17, 2019, 9:42am UTC](https://discuss.elastic.co/t/facet-aggregate-real-or-condition/190940 "2019-07-17T09:42:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aagafonov77](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aagafonov77/32/50335_2.png) [@aagafonov77](https://discuss.elastic.co/u/aagafonov77)\
**Post date:** [July 17, 2019, 9:42am UTC](https://discuss.elastic.co/t/facet-aggregate-real-or-condition/190940/1 "2019-07-17T09:42:52Z")

</div>

Dear friends,

I have problem with filters in ES 7.2

seach request  
{  
'query': {  
'bool': {  
'filter': {  
[  
{  
"bool": {  
"should": {  
"terms": {  
"properties.tip\_lamp": [  
"led"  
]  
}  
}  
}  
},  
{  
"bool": {  
"should": {  
"match": {  
"properties.vid": "\u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043d\u044b\u0435 \u043b\u0430\u043c\u043f\u044b.raw"  
}  
}  
}  
}  
]  
}  
}  
}  
'aggs': [  
"all\_products": {  
"global": {},  
"aggs": {  
"properties.vid": {  
"terms": {  
"field": "properties.vid.keyword",  
"min\_doc\_count": 0,  
"size": 100  
}  
}  
}  
},  
"properties.tip\_lampy": {  
"terms": {  
"field": "properties.tip\_lampy.keyword",  
"min\_doc\_count": 0,  
"size": 100  
},  
"properties.klass\_vlagozashchity": {  
"terms": {  
"field": "properties.klass\_vlagozashchity.keyword",  
"min\_doc\_count": 0,  
"size": 100  
}  
},  
],

```
        }
    }

```

get list of aggrigation for properties.klass\_vlagozashchity values:

IP20 (253)  
IP40 (1)  
IP44 (2)  
IP21 (0)  
IP22 (0)

When I add to query IP44, products has two values.

```
{
  'query': {
    'bool': {
      'filter': [
        {
          "bool": {
            "should": {
              "terms": {
                "properties.klass_vlagozashchity": [
                  "ip44"
                ]
              }
            }
          }
        },
        {
          "bool": {
            "should": {
              "terms": {
                "properties.tip_lamp": [
                  "led"
                ]
              }
            }
          }
        },
        {
          "bool": {
            "should": {
              "match": {
                "properties.vid": "\u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043d\u044b\u0435 \u043b\u0430\u043c\u043f\u044b.raw"
              }
            }
          }
        }
      ]
    }
  },
  'aggs' ..... same
}

```

get list of aggrigation for properties.klass\_vlagozashchity values:

IP44 (2)  
IP20 (0)  
IP21 (0)  
IP22 (0)  
IP40 (0)

Also change facets for properties.tip\_lamp is right but changes for in facet properties.klass\_vlagozashchity is wrong.

How I can make facets properties.tip\_lamp real OR condition inside property.

Alex

---

<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:** [August 14, 2019, 9:47am UTC](https://discuss.elastic.co/t/facet-aggregate-real-or-condition/190940/2 "2019-08-14T09:47:25Z")

</div>

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