Arangodb 嵌套字段的地理索引?

Arangodb 嵌套字段的地理索引?,arangodb,Arangodb,我有以下JSON结构: { "type": "Feature", "id": "node/1717565071", "properties": { "type": "node", "id": 1717565071, "tags": { "amenity": "post_box", "operator": "P&T", "collection_times": "Mo-Fr 08:30, Sa 08:00" },

我有以下JSON结构:

{
  "type": "Feature",
  "id": "node/1717565071",
  "properties": {
    "type": "node",
    "id": 1717565071,
    "tags": {
      "amenity": "post_box",
      "operator": "P&T",
      "collection_times": "Mo-Fr 08:30, Sa 08:00"
    },
    "relations": [],
    "meta": {
      "timestamp": "2012-04-15T09:24:35Z",
      "version": 1,
      "changeset": 11307674,
      "user": "kewl",
      "uid": 317259
    }
  },
  "geometry": {
    "type": "Point",
    "coordinates": [
      6.1428674,
      49.5716325
    ]
  }
}
我需要为它运行geoindex的创建

我运行命令:

127.0.0.1:8529@geodb> db.lux1.ensureIndex({ type: "geo", fields: [ "coordinates" ] } )
{
  "id" : "lux1/569778",
  "type" : "geo1",
  "fields" : [
    "coordinates"
  ],
  "geoJson" : false,
  "constraint" : false,
  "unique" : false,
  "ignoreNull" : true,
  "sparse" : true,
  "isNewlyCreated" : false,
  "code" : 200
}
我希望进行一些处理,但不是简单的输出

我也试过:

127.0.0.1:8529@geodb> db.lux1.ensureIndex({ type: "geo", fields: [ "geometry.coordinates" ] } )
{
  "id" : "lux1/570071",
  "type" : "geo1",
  "fields" : [
    "geometry.coordinates"
  ],
  "geoJson" : false,
  "constraint" : false,
  "unique" : false,
  "ignoreNull" : true,
  "sparse" : true,
  "isNewlyCreated" : true,
  "code" : 201
}
我想我错过了
字段


如何为创建索引指定正确的键?

您的第一次尝试显然是错误的,因为路径错误。ArangoDB已经告诉您:
“isNewlyCreated”:false

第二次尝试是正确的,ArangoDB还告诉您:
“isNewlyCreated”:true

那你为什么认为它不起作用?试试地理查询。如果字段上没有地理索引,则会出现错误

阅读更多关于: