简体   繁体   中英

elasticsearch php client range filter issue

i dont get this range filter to work with the elasticsearch php client:

Array ( 
[index] => xyz
[type] => imagesearch 
[body] => Array ( 
   [from] => 0 
   [size] => 10 
   [query] => Array ( 
      [filtered] => Array ( 
          [filter] => Array ( 
             [bool] => Array ( 
               [must] => Array ( 
                 [term] => Array ( 
                    [type] => abc 
                    [stationId] => 01
               ) 
               [range] => Array ( 
                    [timestamp] => Array ( 
                       [gt] => 1449356400 
                       ) 
                    )
               ) 
          ) 
       ) 
       [query] => Array ( 
          [match] => Array (
            [_all] => Hund 
          ) 
       ) 
     ) 
   ) 
) 

)

without the range filter the query/filter works fine. what am i missing?

Elasticsearch (backed by Java) uses different format for timestamp. Instead of seconds it uses miliseconds, so you have to multiply your timestamp by 1000.

To solve problems like these there are abstraction levels for PHP and integrations for frameworks .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM