Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
<img src="//i.stack.imgur.com/RUiNP.png" height="16" width="18" alt="" class="sponsor tag img">elasticsearch Couchbase-Elasticsearch:自定义动态类型_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch_Couchbase - Fatal编程技术网 elasticsearch Couchbase-Elasticsearch:自定义动态类型,elasticsearch,couchbase,elasticsearch,Couchbase" /> elasticsearch Couchbase-Elasticsearch:自定义动态类型,elasticsearch,couchbase,elasticsearch,Couchbase" />

elasticsearch Couchbase-Elasticsearch:自定义动态类型

elasticsearch Couchbase-Elasticsearch:自定义动态类型,elasticsearch,couchbase,elasticsearch,Couchbase,我使用XDCR复制在CB和Elasticsearch之间同步数据,使用couchbase传输插件进行Elasticsearch。 据我所知,Couchbase中的所有文档都将带有“couchbaseDocument”类型。但是我有不同的文档类型,每个文档都有特定的映射 有没有办法使用特定的动态类型而不是默认的“couchbaseDocument” (其中,如果json文档有一个字段“type”:“beer”,它将在ES中被索引为_type:“beer”;如果是“type”:“wine”,它将被索

我使用XDCR复制在CB和Elasticsearch之间同步数据,使用couchbase传输插件进行Elasticsearch。 据我所知,Couchbase中的所有文档都将带有“couchbaseDocument”类型。但是我有不同的文档类型,每个文档都有特定的映射

有没有办法使用特定的动态类型而不是默认的“couchbaseDocument”

(其中,如果json文档有一个字段“type”:“beer”,它将在ES中被索引为_type:“beer”;如果是“type”:“wine”,它将被索引为_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"
                        }
                    }
                }
            }
        }
    }
}'