couchbase从nodejs创建全文本搜索索引

时间:2019-06-11 06:48:16

标签: node.js couchbase

我正在尝试从nodejs couchbase库创建全文索引,但找不到api调用,或者我丢失了某些内容。它以CURL记录

此处是FTS索引

{
 "name": "myIndex",
 "type": "fulltext-index",
 "params": {
  "mapping": {
   "default_mapping": {
    "enabled": true,
    "dynamic": true
   },
   "default_type": "_default",
   "default_analyzer": "standard",
   "default_datetime_parser": "dateTimeOptional",
   "default_field": "_all",
   "store_dynamic": false,
   "index_dynamic": true
  },
  "store": {
   "indexType": "scorch",
   "kvStoreName": ""
  },
  "doc_config": {
   "mode": "type_field",
   "type_field": "type",
   "docid_prefix_delim": "",
   "docid_regexp": ""
  }
 },
 "sourceType": "couchbase",
 "sourceName": "contacts",
 "sourceUUID": "cc9837d1be08c2276d2c123e299a5386",
 "sourceParams": {},
 "planParams": {
  "maxPartitionsPerPIndex": 171,
  "numReplicas": 0
 },
 "uuid": ""
}

1 个答案:

答案 0 :(得分:0)

您可以使用以下命令创建索引:

curl -XPUT -H "Content-type:application/json" http://<USER>:<PASSWORD>@<IP_ADDRESSES>:8094/api/index/NAME_OF_YOUR_INDEX -d @your_json_file.json

此存储库的第6步有一个实际的示例: https://github.com/deniswsrosa/couchflix