# Elasticsearch php client range and search

**URL:** <https://discuss.elastic.co/t/elasticsearch-php-client-range-and-search/96951>\
**Category:** Elasticsearch\
**Created:** [August 14, 2017, 11:04am UTC](https://discuss.elastic.co/t/elasticsearch-php-client-range-and-search/96951 "2017-08-14T11:04:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Akhil\_Prashar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akhil_prashar/32/20313_2.png) [@Akhil\_Prashar](https://discuss.elastic.co/u/Akhil_Prashar)\
**Post date:** [August 14, 2017, 11:04am UTC](https://discuss.elastic.co/t/elasticsearch-php-client-range-and-search/96951/1 "2017-08-14T11:04:37Z")

</div>

I am using the following query :  
$params = ['index' =\> '201706', 'type' =\> 'youtube','body' =\> ['query' =\> ['bool' =\> [ 'filter' =\> ['range' =\> ['created\_at' =\> [ 'gte'=\> '2017-06-25 00:00:00','lte' =\> '2017-09-30 00:00:00']]], 'query' =\> ['match' =\> ['description' =\> 'kashmir']],],] ] ];

And I am getting this error:

PHP 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":119}],"type":"parsing\_exception","reason":"[bool] query does not support [query]","line":1,"col":119},"status":400}' in /home/akhil/Documents/june/elastic/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:610

Kindly help me rectify this issue  
Thanks,  
Akhil

---

<div class="post-metadata">

**Author:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [August 18, 2017, 3:24pm UTC](https://discuss.elastic.co/t/elasticsearch-php-client-range-and-search/96951/2 "2017-08-18T15:24:24Z")

</div>

Formatted:

```auto
$params = [
  'index' => '201706', 
  'type' => 'youtube', 
  'body' => [
    'query' => [
        'bool' => [
          'filter' => [
            'range' => [
                'created_at' => [
                    'gte' => '2017-06-25 00:00:00',
                    'lte' => '2017-09-30 00:00:00'
                ]
            ]
          ], 
          'query' => [
              'match' => [
                'description' => 'kashmir'
              ]
          ], 
      ],
    ]
  ]
];

```

The error is basically what it says: the boolean query doesn't support a "query" parameter, which you've added under the "filter" parameter.

Was your intention to make the match query a required component? The allowed parameters to a boolean query are `must`, `must_not`, `should` and `filter`.

---

<div class="post-metadata">

**Author:** ![Akhil\_Prashar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akhil_prashar/32/20313_2.png) [@Akhil\_Prashar](https://discuss.elastic.co/u/Akhil_Prashar)\
**Post date:** [August 21, 2017, 11:54am UTC](https://discuss.elastic.co/t/elasticsearch-php-client-range-and-search/96951/3 "2017-08-21T11:54:12Z")

</div>

Thanks a ton man!

---

<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:** [September 18, 2017, 12:05pm UTC](https://discuss.elastic.co/t/elasticsearch-php-client-range-and-search/96951/4 "2017-09-18T12:05:03Z")

</div>

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