# Boolean filter question

**URL:** <https://discuss.elastic.co/t/boolean-filter-question/248346>\
**Category:** Elasticsearch\
**Created:** [September 11, 2020, 2:38pm UTC](https://discuss.elastic.co/t/boolean-filter-question/248346 "2020-09-11T14:38:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shon3r](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shon3r/32/75466_2.png) [@shon3r](https://discuss.elastic.co/u/shon3r)\
**Post date:** [September 11, 2020, 2:38pm UTC](https://discuss.elastic.co/t/boolean-filter-question/248346/1 "2020-09-11T14:38:39Z")

</div>

Hello,

I have a problem with filter in boolean query.

I want to apply a filter based on 3 fields with 1 minimum filter match :

```auto
$params = [
    'from' => 0,
    'size' => 25,
    'index' => 'document',
    'body' => [
        'query' => [
            'bool' => [
                'filter' => [
                    'bool' => [
                        'minimum_should_match' => 1,
                        'should' => [
                            'term' => [
                                'VISIBILITE' => 'T'
                            ],
                            'term' => [
                                'ECRITURE' => 'M'
                            ],
                            'term' => [
                                'LECTURE' => 'M'
                            ],
                        ]
                    ]
                ],
                'must' => [
                    [
                        'bool' => [
                            'should' => [ 
                                [
                                    'match' => [
                                        'OBJET' => $recherche,
                                    ]
                                ],
                                [
                                    'match' => [
                                        'TYPEDOCUMENT' => $recherche
                                    ]
                                ],
                                [
                                    'match' => [
                                        'NOMPERSONNE' => $recherche
                                    ]
                                ],
                                [
                                    'match' => [
                                        'PRENOMPERSONNE' => $recherche
                                    ]
                                ],
                                [
                                    'match' => [
                                        'NUMDOCUMENT' => [
                                            'query' => $recherche,
                                            'boost' => 2
                                        ]
                                    ]
                                ],
                                [
                                    'match' => [
                                        'MOTCLES' => $recherche
                                    ]
                                ],
                            ] 
                        ]
                    ],
                ],
            ],
        ],
    ],
];

```

I get no result with this query, however i see lots of relevant documents in index.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [September 17, 2020, 1:32pm UTC](https://discuss.elastic.co/t/boolean-filter-question/248346/2 "2020-09-17T13:32:37Z")

</div>

As this does not contain a fully reproducible example, I can only forward you to the [Explain API](https://www.elastic.co/guide/en/elasticsearch/reference/7.8/search-explain.html), allowing you to figure out why a document does not match even though it should.

---

<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:** [October 15, 2020, 1:32pm UTC](https://discuss.elastic.co/t/boolean-filter-question/248346/3 "2020-10-15T13:32:47Z")

</div>

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