简体   繁体   English

是否可以在 arangodb 中事先不知道确切结构的情况下对所有属性进行索引?

[英]Is it possible to index all attributes without knowing exact structure beforehand in arangodb?

I have a collection with simple documents like this我有一个像这样的简单文档的集合

{
key1:value,
key2:value2,
....
}

I would like to index all keys separately.我想分别索引所有键。

But the current arangodb UI only provide a list of attributes seperated by comma, eg.但是当前的 arangodb UI 只提供了一个以逗号分隔的属性列表,例如。 [key1,key2] as input. [key1,key2]作为输入。 So I have to define those attributes beforehand所以我必须事先定义这些属性

Is there something like * to tell arango to index all attributes.有没有像 * 这样的东西告诉 arango 索引所有属性。

The standard indexes do not support wildcards to index all attributes (and multiple paths in an index definition will create a combined index, not a union of all keys).标准索引不支持通配符来索引所有属性(索引定义中的多个路径将创建组合索引,而不是所有键的联合)。 But you can create an ArangoSearch View and let it index all attributes:但是您可以创建一个ArangoSearch 视图并让它索引所有属性:

{
  "type": "arangosearch",
  "links": {
    "coll": {
      "analyzers": [
        "identity"
      ],
      "includeAllFields": true
    }
  }
}

Then add some documents into the collection coll :然后将一些文档添加到集合coll中:

  • {"foo": 1}
  • {"bar": 2}
  • {"baz": {"nested": 3} }

And finally query the View (here called someView ), using the default identity Analyzer:最后使用默认的identity分析器查询视图(这里称为someView ):

FOR doc IN someView
  SEARCH doc.baz.nested == 3
  RETURN doc

As you can see, all attributes including nested ones are indexed by the using the includeAllFields option at the top-level.如您所见,包括嵌套属性在内的所有属性都通过使用顶级的includeAllFields选项进行索引。

More info: https://www.arangodb.com/docs/stable/arangosearch.html更多信息: https://www.arangodb.com/docs/stable/arangosearch.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM