elasticsearch Couchbase-Elasticsearch:自定义动态类型
我使用XDCR复制在CB和Elasticsearch之间同步数据,使用couchbase传输插件进行Elasticsearch。 据我所知,Couchbase中的所有文档都将带有“couchbaseDocument”类型。但是我有不同的文档类型,每个文档都有特定的映射 有没有办法使用特定的动态类型而不是默认的“couchbaseDocument” (其中,如果json文档有一个字段“type”:“beer”,它将在ES中被索引为_type:“beer”;如果是“type”:“wine”,它将被索引为_type:“wine”)elasticsearch Couchbase-Elasticsearch:自定义动态类型,elasticsearch,couchbase,elasticsearch,Couchbase,我使用XDCR复制在CB和Elasticsearch之间同步数据,使用couchbase传输插件进行Elasticsearch。 据我所知,Couchbase中的所有文档都将带有“couchbaseDocument”类型。但是我有不同的文档类型,每个文档都有特定的映射 有没有办法使用特定的动态类型而不是默认的“couchbaseDocument” (其中,如果json文档有一个字段“type”:“beer”,它将在ES中被索引为_type:“beer”;如果是“type”:“wine”,它将被索
我在couchbase拥有的:
bucket: "drinks",
beer_1234:
{
"type": "beer",
"name": "leffe"
}
Elasticsearch中的索引方式:
{
"_index": "drinks",
"_type": "couchbaseDocument", // <======================== ????
"_id": "beer_1234",
"_version": 1,
"_source": {
"doc": {
"type": "beer",
"name": "leffe"
},
"meta": {
"id": "beer_1234",
"rev": "9-000049e945bd62fa0000000000000000",
"expiration": 0,
"flags": 0
}
}
{
“_索引”:“饮料”,
“_type”:“couchbaseDocument”,//其原理是修改默认传输映射以索引您的type
字段。例如:
curl -XPUT 'http: //localhost:9200/drinks/'-d'{
"mappings": {
"couchbaseCheckpoint": {
"dynamic": "true",
"_source": {
"includes": [
"doc.*"
]
},
"dynamic_templates": [
{
"store_no_index": {
"match": "*",
"mapping": {
"store": "no",
"index": "no",
"include_in_all": false
}
}
}
]
},
"couchbaseDocument": {
"_all": {
"enabled": false
},
"dynamic": "true",
"_source": {
"includes": [
"meta.*"
]
},
"dynamic_templates": [
{
"all_strings_to_avoid_collisions": {
"match": "*",
"mapping": {
"store": "no",
"index": "not_analyzed",
"include_in_all": false,
"type": "string",
"analyzer": "whitespace"
}
}
}
],
"properties": {
"doc": {
"properties": {
"type": {
"type": "string"
}
}
},
"meta": {
"properties": {
"id": {
"type": "string",
"analyzer": "whitespace"
}
}
}
}
}
}
}'
curl -XPUT 'http: //localhost:9200/drinks/'-d'{
"mappings": {
"couchbaseCheckpoint": {
"dynamic": "true",
"_source": {
"includes": [
"doc.*"
]
},
"dynamic_templates": [
{
"store_no_index": {
"match": "*",
"mapping": {
"store": "no",
"index": "no",
"include_in_all": false
}
}
}
]
},
"couchbaseDocument": {
"_all": {
"enabled": false
},
"dynamic": "true",
"_source": {
"includes": [
"meta.*"
]
},
"dynamic_templates": [
{
"all_strings_to_avoid_collisions": {
"match": "*",
"mapping": {
"store": "no",
"index": "not_analyzed",
"include_in_all": false,
"type": "string",
"analyzer": "whitespace"
}
}
}
],
"properties": {
"doc": {
"properties": {
"type": {
"type": "string"
}
}
},
"meta": {
"properties": {
"id": {
"type": "string",
"analyzer": "whitespace"
}
}
}
}
}
}
}'