Elasticsearch:MySQL错误index_not_found_exception

时间:2018-05-06 16:34:58

标签: mysql elasticsearch centos7

我的目标是使用Centos7上的elasticsearch从MySQL数据库中提取数据。

我点了这个链接:ElasticSearch how to integrate with Mysql

  • 创建的名为ElasticSearchDatabase的数据库
    • "测试"表名
  • 安装了Java 8。
  • 安装了Elasticsearch 6.2.4。
  • Elasticsearch-jdbc-2.3.4.1-dist.zip在/ etc / elasticsearch下解压缩
  • "日志"文件夹是在/ etc / elasticsearch
  • 下创建的

我执行时得到了这个结果:

  

curl -XGET' http://localhost:9200/?pretty'

{
  "name" : "vps.server.com",
  "cluster_name" : "my-application",
  "cluster_uuid" : "ICqEEr1VQHK8mZ82x7J_YQ",
  "version" : {
    "number" : "6.2.4",
    "build_hash" : "ccec39f",
    "build_date" : "2018-04-12T20:37:28.497551Z",
    "build_snapshot" : false,
    "lucene_version" : "7.2.1",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"

然后我推了:

echo '{                                               
"type":"jdbc",
"jdbc":{

"url":"jdbc:mysql://localhost:3306/ElasticSearchDatabase",
"user":"root",
"password":"root",
"sql":"SELECT id as _id, id, name,email FROM test",
"index":"users",
"type":"users",
"autocommit":"true",
"metrics": {
            "enabled" : true
        },
        "elasticsearch" : {
             "cluster" : "my-application",
             "host" : "localhost",
             "port" : 9300 
        } 
}
}' | java -cp "/etc/elasticsearch/elasticsearch-jdbc-2.3.4.1/lib/*" - 
 "Dlog4j.configurationFile=file:////etc/elasticsearch/elasticsearch-jdbc- 
  2.3.4.1/bin/log4j2.xml" "org.xbib.tools.Runner" 
 "org.xbib.tools.JDBCImporter"

要获得我想要的结果,我已经执行了这个cmd:

  

curl -XGET http://localhost:9200/users/_search/?pretty

这是我得到的结果:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "index_not_found_exception",
        "reason" : "no such index",
        "resource.type" : "index_or_alias",
        "resource.id" : "users",
        "index_uuid" : "_na_",
        "index" : "users"
      }
    ],
    "type" : "index_not_found_exception",
    "reason" : "no such index",
    "resource.type" : "index_or_alias",
    "resource.id" : "users",
    "index_uuid" : "_na_",
    "index" : "users"
  },
  "status" : 404
}

任何人都对此错误有所了解。 谢谢你的帮助。

0 个答案:

没有答案