src/QueryBuilder/Filters/Filter.php
public function makeQuery()
    {
        $query = $this->query($this->getValues());

        $map = [
            Filter::MERGE_AND => 'must',
            Filter::MERGE_OR => 'should'
        ];

        if ($this->isInclude()) {
            if ($this->getLogicalOperator() == Filter::MERGE_AND) {
                $query = [
                    'bool' => [
                        'must' => [
                            $query
                        ]
                    ]
                ];
            } elseif ($this->getLogicalOperator() == Filter::MERGE_OR) {
                $query = [
                    'bool' => [
                        'should' => [
                            $query
                        ]
                    ]
                ];
            }
        } elseif ($this->isExclude()) {
            $mergeOperator = $map[$this->getLogicalOperator()];
            $query = [
                'bool' => [
                    $mergeOperator => [
                        [
                            'bool' => [
                                'must_not' => [
                                    $query
                                ]
                            ]
                        ]
                    ]
                ]
            ];
        } elseif ($this->isOff()) {
            $query = [];
        }

        foreach ($this->getLinkedFilters() as $filter) {
            $extraQuery = $filter->makeQuery();

//            if ($filter->isInclude()) {
            if ($this->getLogicalOperator() == Filter::MERGE_AND) {
                $query = $this->mergeBoolQuery($query, $extraQuery, 'must');
            } elseif ($this->getLogicalOperator() == Filter::MERGE_OR) {
                $query = $this->mergeBoolQuery($query, $extraQuery, 'should');
            }
//            }
//            elseif ($filter->isExclude()) {
//                $query = $this->mergeBoolQuery($query, $extraQuery, 'must_not');
//            }
        }

        return $query;
    }
public function makeQuery()
    {
        $query = $this->query($this->getValues());

        $map = [
            Filter::MERGE_AND => 'must',
            Filter::MERGE_OR => 'should'
        ];

        if ($this->isInclude()) {
            if ($this->getLogicalOperator() == Filter::MERGE_AND) {
                $query = [
                    'bool' => [
                        'must' => [
                            $query
                        ]
                    ]
                ];
            } elseif ($this->getLogicalOperator() == Filter::MERGE_OR) {
                $query = [
                    'bool' => [
                        'should' => [
                            $query
                        ]
                    ]
                ];
            }
        } elseif ($this->isExclude()) {
            $mergeOperator = $map[$this->getLogicalOperator()];
            $query = [
                'bool' => [
                    $mergeOperator => [
                        [
                            'bool' => [
                                'must_not' => [
                                    $query
                                ]
                            ]
                        ]
                    ]
                ]
            ];
        } elseif ($this->isOff()) {
            $query = [];
        }

        foreach ($this->getLinkedFilters() as $filter) {
            $extraQuery = $filter->makeQuery();

//            if ($filter->isInclude()) {
            if ($this->getLogicalOperator() == Filter::MERGE_AND) {
                $query = $this->mergeBoolQuery($query, $extraQuery, 'must');
            } elseif ($this->getLogicalOperator() == Filter::MERGE_OR) {
                $query = $this->mergeBoolQuery($query, $extraQuery, 'should');
            }
//            }
//            elseif ($filter->isExclude()) {
//                $query = $this->mergeBoolQuery($query, $extraQuery, 'must_not');
//            }
        }

        return $query;
    }
Returns wrapped elasticsearch filter query.
{
"bool": {
"should": [],
"must_not": []
}
}

@return array