无法使用动态模板映射在couchdb上创建弹性搜索 [英] Unable to create elasticsearch river on couchdb using dynamic template mappings

查看:113
本文介绍了无法使用动态模板映射在couchdb上创建弹性搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我尝试使用动态模板来指定映射,使得除对象之外的所有对象都被视为字符串,则河流将失败。

WHen I try to use dynamic templates to specify mapping such that everything other than objects is treated as string, the river fails.

示例 - 我尝试首先清除我的db-tempTest的所有以前的索引和河流。

example - I try to first clear all previous indices and rivers for my db - tempTest.

curl -XDELETE 'localhost:9200/_river/tempTest/'

curl -XDELETE 'localhost:9200/tempTest/'

curl -XPUT localhost:9200/tempTest -d '{
    "mappings": {
        "tempTest": {
            "dynamic_templates" : [
                {
                    "template_obj" : {
                        "match" : "*",
                        "match_mapping_type" : "object",
                        "mapping" : {
                            "type" : "object"
                        }
                    }
                },
                {
                    "template_str" : {
                        "match" : "*",
                        "mapping" : {
                            "type" : "string"
                        }
                    }
                }            
            ]
        }
    }
}'


curl -XPUT 'localhost:9200/_river/tempTest/_meta' -d '{
    "type" : "tempTest",
        "couchdb" : {
            "host" : "localhost",
            "port" : 5984,
            "db" : "tempTest",
            "filter" : null
            },
        "index" : {
            "index" : "tempTest",
            "type" : "tempTest",
            "bulk_size" : "100",
            "bulk_timeout" : "10ms"
            }
}'

这样做,我在弹性搜索错误日志中收到以下错误日志。

After I do this, I get the following error log in elasticsearch error logs.

[2013-01-16 13:52:33,500][WARN ][river                    ] [Starsmore, Jonothon] failed to create river [tempTest][tempTest]
org.elasticsearch.common.settings.NoClassSettingsException: Failed to load class with value [tempTest]
    at org.elasticsearch.river.RiverModule.loadTypeModule(RiverModule.java:86)
    at org.elasticsearch.river.RiverModule.spawnModules(RiverModule.java:57)
    at org.elasticsearch.common.inject.ModulesBuilder.add(ModulesBuilder.java:44)
    at org.elasticsearch.river.RiversService.createRiver(RiversService.java:135)
    at org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:270)
    at org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:264)
    at org.elasticsearch.action.support.TransportAction$ThreadedActionListener$1.run(TransportAction.java:86)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: pirates
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at org.elasticsearch.river.RiverModule.loadTypeModule(RiverModule.java:72)
    ... 9 more


推荐答案

河流类型必须是 CouchDB的。尝试这样:

The river type has to be couchdb. Try this:

curl -XPUT 'localhost:9200/_river/tempTest/_meta' -d '{
    "type": "couchdb",
    "couchdb": {
        "host": "localhost",
        "port": 5984,
        "db": "tempTest",
        "filter": null
    },
    "index": {
        "index": "tempTest",
        "type": "tempTest",
        "bulk_size": "100",
        "bulk_timeout": "10ms"
    }
}
'

这篇关于无法使用动态模板映射在couchdb上创建弹性搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆