首页 文章

Couchbase - Elasticsearch - 运输 . 映射到类型

提问于
浏览
0

我有下一个问题:

我在沙发基地有一个桶 - 名为 cars . 我在elasticsearch中有索引 - 名为 test

我映射了我的文件 . 在 elasticsearch config我设置:

couchbase.typeSelector.defaultDocumentType: 'Test'
couchbase.typeSelector.documentTypeDelimiter: '_'

我开始从couchbase复制到elasticsearch . BUT! All my documents going to default typeTest

我也尝试用 doc.NameOfProperty 映射 - 但它对我没有帮助:(

我不知道为什么它不起作用 .

我的目标 - 通过 TYPE 将文档从couchbase设置为elasticsearch .

谢谢 .

1 回答

  • 1

    您错过了文档类型选择器设置 . 默认情况下,插件使用 DefaultTypeSelector ,它只将所有文档分配给defaultDocumentType,在您的情况下为"Test" .

    要让插件通过根据分隔符拆分id来将文档分配给类型,您需要告诉插件使用 DelimiterTypeSelector . 将以下行添加到elasticsearch.yml以使用您在配置中已有的内容:

    couchbase.typeSelector: org.elasticsearch.transport.couchbase.capi.DelimiterTypeSelector
    

    这样,插件会将任何带有“Something_123”形式的ID的文档分配给“Something”类型,将所有其他文档分配给“Test”类型 .

    您的总沙发基础相关设置应如下所示:

    couchbase.username: Administrator
    couchbase.password: 12345 # Same as the combination on my luggage
    couchbase.ignoreFailures: true
    couchbase.wrapCounters: true
    couchbase.ignoreDotIndexes: true
    couchbase.typeSelector: org.elasticsearch.transport.couchbase.capi.DelimiterTypeSelector
    couchbase.typeSelector.documentTypeDelimiter: '_'
    couchbase.typeSelector.defaultDocumentType: 'Test'
    

相关问题