Couchbase 全文搜索 (FTS) - 我如何 return 存储数据?
Couchbase Full Text Search (FTS) - how do I return bucket data?
我有一个包含大约 200,000 个键的存储桶,我正在使用全文搜索进行查询。数据 return 具有准确的结果,但我需要一种方法 return 桶值数据与结果。
我已经尝试使用继承类型映射索引我想要拉取的对象,但除了 default
类型映射之外,似乎没有任何东西被 fields: ["*"]
编辑 return .文档使 Type Mapping 看起来应该是可能的,但我似乎遗漏了一些东西。我能想到的唯一解决方案是存储生成的 ID 并 运行 它们针对带有 USE KEYS [""]
参数的 SQL 查询。
我是 运行宁 Couchbase 5.1。
桶对象
{
"myData": {
"foo": "bar"
},
"otherData": {
"foo": "bar"
}
}
响应正文
{
"status": {
"total": 6,
"failed": 0,
"successful": 6
},
"request": {
"query": {
"query": "ammonia"
},
"size": 3,
"from": 0,
"highlight": null,
"fields": [
"*"
],
"facets": null,
"explain": false,
"sort": [
"-_score"
],
"includeLocations": false
},
"hits": [
{
"index": "x_lookup_4a3ce884b7959a52_aa574717",
"id": "49648042171",
"score": 2.3192631344475236,
"sort": [
"_score"
]
},
{
"index": "x_lookup_4a3ce884b7959a52_aa574717",
"id": "49648042174",
"score": 2.3192631344475236,
"sort": [
"_score"
]
},
{
"index": "x_lookup_4a3ce884b7959a52_aa574717",
"id": "52735091636",
"score": 2.2918152674612653,
"sort": [
"_score"
]
}
],
"total_hits": 256,
"max_score": 2.3192631344475236,
"took": 699827,
"facets": {}
}
要return桶数据作为搜索结果的一部分,索引内容需要存储。一旦处理完毕,您就可以使用 字段:["*"] 来获取命中的 indexed-stored 内容。
如果您正在使用自定义类型映射,并且正在为其中的 select 个子字段编制索引,您可以为每个字段设置 "store":true您想要作为结果发出的子字段。
"types": {
"medicine": {
"dynamic": true,
"enabled": true,
"properties": {
"content": {
"enabled": true,
"dynamic": false,
"fields": [{
"name": "content",
"type": "text",
"store": true,
"index": true,
"include_term_vectors": true,
"include_in_all": true,
"docvalues": true
}]
}
}
}
}
如果您只是简单地使用默认的动态映射,则需要设置 "store_dynamic": true,这是一个示例焦化指数定义..
{
"name": "sample",
"type": "fulltext-index",
"params": {
"doc_config": {
"docid_prefix_delim": "",
"docid_regexp": "",
"mode": "type_field",
"type_field": "type"
},
"mapping": {
"default_analyzer": "standard",
"default_datetime_parser": "dateTimeOptional",
"default_field": "_all",
"default_mapping": {
"dynamic": true,
"enabled": true
},
"default_type": "_default",
"docvalues_dynamic": true,
"index_dynamic": true,
"store_dynamic": true,
"type_field": "_type"
},
"store": {
"indexType": "scorch",
"kvStoreName": ""
}
},
"sourceType": "couchbase",
"sourceName": "bucket_name",
"sourceUUID": "",
"sourceParams": {},
"planParams": {
"maxPartitionsPerPIndex": 171
},
"uuid": ""
}
如果您从 couchbase-UI 创建索引,您会在“高级”部分找到 "store_dynamic" 选项。
现在您可以尝试对以上述任一方式定义的索引进行精确查询。
请注意,存储内容会增加索引的磁盘占用空间。
我有一个包含大约 200,000 个键的存储桶,我正在使用全文搜索进行查询。数据 return 具有准确的结果,但我需要一种方法 return 桶值数据与结果。
我已经尝试使用继承类型映射索引我想要拉取的对象,但除了 default
类型映射之外,似乎没有任何东西被 fields: ["*"]
编辑 return .文档使 Type Mapping 看起来应该是可能的,但我似乎遗漏了一些东西。我能想到的唯一解决方案是存储生成的 ID 并 运行 它们针对带有 USE KEYS [""]
参数的 SQL 查询。
我是 运行宁 Couchbase 5.1。
桶对象
{
"myData": {
"foo": "bar"
},
"otherData": {
"foo": "bar"
}
}
响应正文
{
"status": {
"total": 6,
"failed": 0,
"successful": 6
},
"request": {
"query": {
"query": "ammonia"
},
"size": 3,
"from": 0,
"highlight": null,
"fields": [
"*"
],
"facets": null,
"explain": false,
"sort": [
"-_score"
],
"includeLocations": false
},
"hits": [
{
"index": "x_lookup_4a3ce884b7959a52_aa574717",
"id": "49648042171",
"score": 2.3192631344475236,
"sort": [
"_score"
]
},
{
"index": "x_lookup_4a3ce884b7959a52_aa574717",
"id": "49648042174",
"score": 2.3192631344475236,
"sort": [
"_score"
]
},
{
"index": "x_lookup_4a3ce884b7959a52_aa574717",
"id": "52735091636",
"score": 2.2918152674612653,
"sort": [
"_score"
]
}
],
"total_hits": 256,
"max_score": 2.3192631344475236,
"took": 699827,
"facets": {}
}
要return桶数据作为搜索结果的一部分,索引内容需要存储。一旦处理完毕,您就可以使用 字段:["*"] 来获取命中的 indexed-stored 内容。
如果您正在使用自定义类型映射,并且正在为其中的 select 个子字段编制索引,您可以为每个字段设置 "store":true您想要作为结果发出的子字段。
"types": {
"medicine": {
"dynamic": true,
"enabled": true,
"properties": {
"content": {
"enabled": true,
"dynamic": false,
"fields": [{
"name": "content",
"type": "text",
"store": true,
"index": true,
"include_term_vectors": true,
"include_in_all": true,
"docvalues": true
}]
}
}
}
}
如果您只是简单地使用默认的动态映射,则需要设置 "store_dynamic": true,这是一个示例焦化指数定义..
{
"name": "sample",
"type": "fulltext-index",
"params": {
"doc_config": {
"docid_prefix_delim": "",
"docid_regexp": "",
"mode": "type_field",
"type_field": "type"
},
"mapping": {
"default_analyzer": "standard",
"default_datetime_parser": "dateTimeOptional",
"default_field": "_all",
"default_mapping": {
"dynamic": true,
"enabled": true
},
"default_type": "_default",
"docvalues_dynamic": true,
"index_dynamic": true,
"store_dynamic": true,
"type_field": "_type"
},
"store": {
"indexType": "scorch",
"kvStoreName": ""
}
},
"sourceType": "couchbase",
"sourceName": "bucket_name",
"sourceUUID": "",
"sourceParams": {},
"planParams": {
"maxPartitionsPerPIndex": 171
},
"uuid": ""
}
如果您从 couchbase-UI 创建索引,您会在“高级”部分找到 "store_dynamic" 选项。
现在您可以尝试对以上述任一方式定义的索引进行精确查询。
请注意,存储内容会增加索引的磁盘占用空间。