- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我在nodejs应用程序中使用elasticsearch模块,以便通过geo_points查找文档。
根据http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-search ,我正在尝试这样做:
client.search({
index: 'myindex',
type: 'mytype',
body: {
filtered : {
query : {
match_all : {}
},
filter : {
geo_distance : {
distance : "200km",
coordiates : {
lat : 40,
lon : -70
}
}
}
}
}
}).then(function (resp) {
var hits = resp.hits.hits;
console.log(hits, "items");
}).catch(function (error) {
console.log("Error on geo_distance");
});
但我总是遇到搜索解析错误。
有人有想法吗?
谢谢
最佳答案
最后,我找到了正确的语法/参数:
client.search({
index: 'myindex',
type: 'mytype',
body: {
from: from,
size: size,
query: {
filtered: {
filter: {
geo_distance: {
distance: '100000km',
coordiates: {
lat: 0.0,
lon: 0.0
}
}
}
}
}
}
}).then(function (resp) {
var hits = resp.hits.hits;
console.log(hits.length, "items around");
}).catch(function (error) {
console.log("Error on geo_distance (coordiates)");
});
感谢 Jhilden 的帮助。
关于node.js - Elasticsearch node.js geo_distance 过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30172504/
我正在尝试使用 elasticsearch 进行按邻近度排序的搜索。我安装了 FOSElasticaBundle 并且在我的 config.yml 中有这个配置: fos_elastica:
我无法让我的过滤器查询与 geo_distance 一起正常工作。它似乎返回 0 次点击。但是,如果我不尝试查找地理位置,我的所有其他查询都有效。 我正在使用 2.3.1 版的 ElasticSear
我正在使用elasticsearch-dsl-drf,我只是将文档上的单个location字段转换为具有以下定义的NestedField: location = fields.NestedField(
我在nodejs应用程序中使用elasticsearch模块,以便通过geo_points查找文档。 根据http://www.elastic.co/guide/en/elasticsearch/cl
点击 { "_index" : "users", "_type" : "user", "_id" : "001", "_score" : 1, "_source
我想运行一个 elasticsearch 查询来查找给定点 10 英里内的项目。 我知道如何用帖子来做,但我想对 uri 中的所有内容使用 get。 我找到了下面的例子,但它不起作用。 http://
我有地理对象的 Elasticsearch 数据库。我想在自定义距离内搜索一些 geo_point 周围最近的对象,然后将它们显示在谷歌地图上。使用默认的 elasticsearch 过滤器 - ge
我是一名优秀的程序员,十分优秀!