弹性搜索geo_shape查询未返回预期结果



这是为我的帖子创建映射的代码.d

$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 的方法吗? 我只使用过浏览器,我不确定如何通过浏览器界面和查询参数进行这样的复杂查询。

我想

如果我把单位放在半径上会有所帮助。 将 mi 添加到半径有效。

相关内容

  • 没有找到相关文章