我正在尝试存储大量双重链接的文档,即它们可以有前任和后继.由于集合存在不同的文档,我不确定我是否可以在其上创建可行的索引:
{"_id": "1234", "title": "Document1", "content":"...", "next": "1236"}
{"_id": "1235", "title": "Document2", "content":"...", "next": "1238"}
{"_id": "1236", "title": "Document1a", "content":"...", "prev": "1234"}
{"_id": "1237", "title": "Document2a", "content":"...", "prev": "1235", "next": "1238"}
{"_id": "1238", "title": "Document2b", "content":"...", "prev": "1237", "next": "1239"}
...
Run Code Online (Sandbox Code Playgroud)
由于我需要包含prev和next文档的文档的整个"历史记录",我想我必须根据列表的大小执行大量查询?
有关如何创建高性能索引的任何建议?用于存储双链表的不同结构也将是有趣的.
我正在尝试通过以下代码片段从 ES 中获取一些地理数据:
result = es.search(
index="loc",
body={
{
"filtered" : {
"query" : {
"field" : { "text" : "restaurant" }
},
"filter" : {
"geo_distance" : {
"distance" : "12km",
"location" : {
"lat" : 40,
"lon" : -70
}
}
}
}
}
}
)
Run Code Online (Sandbox Code Playgroud)
然而,由于以下错误,查询未成功:
"lon" : -70
TypeError: unhashable type: 'dict'
Run Code Online (Sandbox Code Playgroud)
location 字段正确映射到 geo_point 类型,查询取自官方示例。我编写查询的方式有问题吗?