2017-05-23 11 views
0

を返さないここに私のposts.dのための私のマッピングElasticSearch geo_shapeクエリは、ここで期待される結果

$this->createMapping('posts', [ 
     'id' => ['type' => 'integer'], 
     'title' => ['type' => 'string'], 
     'description' => ['type' => 'string'], 
     'price' => ['type' => 'integer'], 
     'obo' => ['type' => 'boolean'], 
     'payment_method' => ['type' => 'string'], 
     'shipping_method' => ['type' => 'string'], 
     'special_instructions' => ['type' => 'string'], 
     'username' => ['type' => 'string'], 
     'post_location' => ['type' => 'geo_point'], 
     'reach' => ['type' => 'geo_shape'], 
     'post_location_string' => ['type' => 'string'], 
     'post_location_postcode' => ['type' => 'string'], 
     'is_spotlight' => ['type' => 'boolean'], 
     'spotlight_range' => ['type' => 'string'], 
     'spotlight_expiration' => ['type' => 'date', 'format' => 'yyyy-MM-dd HH:mm:ss'], 
     'post_created_at' => ['type' => 'date', 'format' => 'yyyy-MM-dd HH:mm:ss'], 
     'post_updated_at' => ['type' => 'date', 'format' => 'yyyy-MM-dd HH:mm:ss'] 
    ]); 

を作成し、私のクエリは、私は結果でこの文書を参照することが期待

$params = [ 
    'index' => 'ryno', 
    'type' => 'posts', 
    'size' => 10, 
    'from' => 0, 
    'body' => [ 
     "sort" => [ 
      "post_created_at" => [ 
       "order" => "desc" 
      ] 
     ], 
     'query' => [ 
      'filtered' => [ 
       'query' => [ 
        'match' => [ 
         "is_spotlight" => true 
        ] 
       ], 
       'filter' => [ 
        'geo_shape' => [ 
         'reach' => [ 
          'relation' => 'INTERSECTS', 
           'shape' => [ 
            'type' => 'circle', 
            'coordinates' => [-73.261700, 42.969900], 
            'radius' => '20mi' 
           ] 
          ] 
         ] 
        ] 
       ] 
      ] 
     ] 
    ]; 

あるコードです。

{ 
    "_index": "ryno", 
    "_type": "posts", 
    "_id": "51", 
    "_score": 10.347348, 
    "_source": { 
     "id": 51, 
     "user_id": 148, 
     "title": "1956 cadilac series 62 ", 
     "slug": "310408-1956-cadilac-series-62", 
     "description": "1956 cadilac series 62 all origulnal 49 k Original miles runs drives great everything works a former Howard Hughes collector car call for info and more details the appraisal is $72 k selling today for  $38.500 injury forces sale won't last call 951-961-2800", 
     "price": 3850000, 
     "obo": false, 
     "payment_method": "Cash,Bank Check", 
     "shipping_method": "Pick Up Only,Ground", 
     "special_instructions": "", 
     "post_created_at": "2017-05-20 22:13:39", 
     "post_updated_at": "2017-05-20 22:20:20", 
     "post_deleted_at": "", 
     "post_location_string": "Sun City, CA US", 
     "post_location_postcode": "92585", 
     "username": "Chip12979", 
     "post_location": { 
      "lat": 33.7415, 
      "lon": -117.1889 
     }, 
     "is_spotlight": true, 
     "default_images": { 
     "small": "https://s3.amazonaws.com/ryno-post-images/1496290519-small.JPG", 
     "medium": "https://s3.amazonaws.com/ryno-post-images/1496290519-medium.JPG", 
     "large": "https://s3.amazonaws.com/ryno-post-images/1496290519.JPG" 
    }, 
    "spotlight_expiration": "2017-06-23 17:31:50", 
    "spotlight_range": "Worldwide", 
    "reach": { 
     "coordinates": [-117.1889, 33.7415], 
      "type": "circle", 
      "radius": 250000 
     } 
    } 
} 

誰もPAWのようなクライアントからESを叩く方法を提案できますか?私はこれまでにブラウザを使用してきただけであり、ブラウザインタフェースとクエリ引数を使用してこのような複雑なクエリを実行する方法がわかりません。

答えて

0

私は半径にユニットを置くと助けになると思います。半径にmiを加えると効果があります。

関連する問題