# Search Operations PHP- API (Documentation typo?)

**URL:** <https://discuss.elastic.co/t/search-operations-php-api-documentation-typo/75769>\
**Category:** Elasticsearch\
**Created:** [February 20, 2017, 3:54pm UTC](https://discuss.elastic.co/t/search-operations-php-api-documentation-typo/75769 "2017-02-20T15:54:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmp.juan](https://avatars.discourse-cdn.com/v4/letter/j/8491ac/32.png) [@jmp.juan](https://discuss.elastic.co/u/jmp.juan)\
**Post date:** [February 20, 2017, 3:54pm UTC](https://discuss.elastic.co/t/search-operations-php-api-documentation-typo/75769/1 "2017-02-20T15:54:16Z")

</div>

Hello everyone!

I am pretty new to Elasticsearch so maybe this is a newbie question but it took me some time to make search queries work in PHP - API.

As per in the documentation ([https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/\_search\_operations.html#\_a\_more\_complicated\_example](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/_search_operations.html#_a_more_complicated_example)) the correct way to construct a "boolean query that contains both a filter and a query" is this:

```
$params = [
    'index' => 'my_index',
    'type' => 'my_type',
    'body' => [
        'query' => [
            'bool' => [
                'filter' => [
                    'term' => ['my_field' => 'abc']
                ],
                'query' => [
                    'match' => ['my_other_field' => 'xyz']
                ]
            ]
        ]
    ]
];

```

But every time I try this way the following error is displayed:

Fatal error: Uncaught exception 'Elasticsearch\Common\Exceptions\BadRequest400Exception' with message '{"error":{"root\_cause":[{"type":"parsing\_exception","reason":"[bool] query does not support [query]","line":1,"col":92}],"type":"parsing\_exception","reason":"[bool] query does not support [query]","line":1,"col":92},"status":400}'

**Same error in Kibana:**

```
{
  "error": {
    "root_cause": [
      {
        "type": "parsing_exception",
        "reason": "[bool] query does not support [query]",
        "line": 7,
        "col": 23
      }
    ],
    "type": "parsing_exception",
    "reason": "[bool] query does not support [query]",
    "line": 7,
    "col": 23
  },
  "status": 400
}

```

The only way it worked for me is changing the "query" term by "must":

```
$params = [
    'index' => 'my_index',
    'type' => 'my_type',
    'body' => [
        'query' => [
            'bool' => [
                'filter' => [
                    'term' => ['my_field' => 'abc']
                ],
                'must' => [
                    'match' => ['my_other_field' => 'xyz']
                ]
            ]
        ]
    ]
];

```

Am I doing something wrong or it is maybe a documentation issue?

Many thanks!

Juan.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 21, 2017, 1:54am UTC](https://discuss.elastic.co/t/search-operations-php-api-documentation-typo/75769/2 "2017-02-21T01:54:05Z")

</div>

What version are you using?

---

<div class="post-metadata">

**Author:** ![jmp.juan](https://avatars.discourse-cdn.com/v4/letter/j/8491ac/32.png) [@jmp.juan](https://discuss.elastic.co/u/jmp.juan)\
**Post date:** [February 21, 2017, 7:46am UTC](https://discuss.elastic.co/t/search-operations-php-api-documentation-typo/75769/3 "2017-02-21T07:46:15Z")

</div>

Sorry, I completely forgot to mention it. I'm currently in 5.2.1.

---

<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:** [March 21, 2017, 7:46am UTC](https://discuss.elastic.co/t/search-operations-php-api-documentation-typo/75769/4 "2017-03-21T07:46:15Z")

</div>

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