Facet aggregate real OR condition

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

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