简体   繁体   English

elasticsearch php客户端范围过滤器问题

[英]elasticsearch php client range filter issue

i dont get this range filter to work with the elasticsearch php client: 我没有得到这个范围过滤器与elasticsearch php客户端一起使用:

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. Elasticsearch(由Java支持)使用不同的时间戳格式。 Instead of seconds it uses miliseconds, so you have to multiply your timestamp by 1000. 它使用毫秒而不是秒,因此必须将时间戳乘以1000。

To solve problems like these there are abstraction levels for PHP and integrations for frameworks . 为了解决此类问题,有PHP的抽象级别框架的集成

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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