I changed the filter to this:

                        "filter" : {
                                "bool" :  {
                                        "must" : [
                                                "range" : {
                                                        "fecha" : {
                                                                "gte" : 
"1325394000",
                                                                "lte" : 
"1356930000"
                                                        }
                                                },
                                                {
                                                        "term" : { 
"aq_industryid" : 1 }
                                                },
                                                {
                                                        "term" : { 
"aq_clientid" : 1 }
                                                },
                                                {
                                                        "term" : { "ntipo" 
: [5] }
                                                }
                                        ]
                                }
                        }

But it keeps the error:

PHP Fatal error:  Uncaught exception 
'Guzzle\Http\Exception\ClientErrorResponseException' with message 'Client 
error response
[status code] 400
[reason phrase] Bad Request
[url] http://localhost:9200/quantico_index/quantico_type/_search' in 
/root/vendor/guzzle/http/Guzzle/Http/Exception/BadResponseException.php:43
Stack trace:
#0 /root/vendor/guzzle/http/Guzzle/Http/Message/Request.php(145): 
Guzzle\Http\Exception\BadResponseException::factory(Object(Guzzle\Http\Message\EntityEnclosingRequest),
 
Object(Guzzle\Http\Message\Response))
#1 [internal function]: 
Guzzle\Http\Message\Request::onRequestError(Object(Guzzle\Common\Event), 
'request.error', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#2 
/root/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php(164):
 
call_user_func(Array, Object(Guzzle\Common\Event), 'request.error', 
Object(Symfony\Component\EventDispatcher\EventDispatcher))
#3 
/root/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php(53):
 
Symf in 
/root/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/GuzzleConnection.php
 
on line 266


On Friday, December 12, 2014 3:06:47 PM UTC-5, David Pilato wrote:
>
> Oh I see. Filter accepts only one filter. You should put your range inside 
> the Must array.
>
> David
>
> Le 12 déc. 2014 à 21:04, Bruno Kamiche <[email protected] <javascript:>> 
> a écrit :
>
> Hello, I'm testing elastic search and I need to apply different filters, 
> when I include the "range" filter I get an error and the query is not 
> executed, here's the json:
>
> $json = '{
>         "size" : 10,
>         "from" : 0,
>         "sort" : [
>                 { "_timestamp" : { "order" : "desc" } },
>                 { "_score" : { "order" : "desc" } }
>         ],
>         "query" : {
>                 "filtered" : {
>                         "query" : {
>                                 "query_string" : {
>                                         "fields" : ["mytextfield"],
>                                         "query" : "my query string",
>                                         "default_operator" : "AND"
>                                 }
>                         },
>                         "filter" : {
>                                 "range" : {
>                                         "datefields" : {
>                                                 "gte" : "1325394000",
>                                                 "lte" : "1356930000"
>                                         }
>                                 },
>                                 "bool" :  {
>                                         "must" : [
>                                                 {
>                                                         "term" : { 
> "aq_industryid" : 1 }
>                                                 },
>                                                 {
>                                                         "term" : { 
> "aq_clientid" : 1 }
>                                                 },
>                                                 {
>                                                         "term" : { "ntipo" 
> : [5] }
>                                                 }
>                                         ]
>                                 }
>                         }
>                 }
>
>         }
> }';
>
> If I don't include the "range" filter, everything works fine (filtering by 
> the other fields, number of results, order, etc), what am I doing wrong?
>
>  -- 
> You received this message because you are subscribed to the Google Groups 
> "elasticsearch" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elasticsearch/be4ca3a2-081f-458a-a006-8d8e80ef23e5%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/elasticsearch/be4ca3a2-081f-458a-a006-8d8e80ef23e5%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/915649e8-57b3-4315-90c6-bba820665c00%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to