埃拉斯ticsearch:mysql error 索引未找到异常

crcmnpdw  于 2021-06-25  发布在  Mysql
关注(0)|答案(0)|浏览(221)

我的目标是在centos7上使用elasticsearch从mysql数据库中提取数据。
我跟踪了这个link:elasticsearch how 与mysql集成。
已创建名为elasticsearchdatabase的数据库
“test”表名
已安装java 8。
已安装elasticsearch 6.2.4。
elasticsearch-jdbc-2.3.4.1-dist.zip在/etc/elasticsearch下解压缩
“logs”文件夹是在/etc/elasticsearch下创建的
当我执行以下命令时得到了这个结果:
curl -xget'http://localhost:9200/“漂亮”

  1. {
  2. "name" : "vps.server.com",
  3. "cluster_name" : "my-application",
  4. "cluster_uuid" : "ICqEEr1VQHK8mZ82x7J_YQ",
  5. "version" : {
  6. "number" : "6.2.4",
  7. "build_hash" : "ccec39f",
  8. "build_date" : "2018-04-12T20:37:28.497551Z",
  9. "build_snapshot" : false,
  10. "lucene_version" : "7.2.1",
  11. "minimum_wire_compatibility_version" : "5.6.0",
  12. "minimum_index_compatibility_version" : "5.0.0"
  13. },
  14. "tagline" : "You Know, for Search"

然后我把:

  1. echo '{
  2. "type":"jdbc",
  3. "jdbc":{
  4. "url":"jdbc:mysql://localhost:3306/ElasticSearchDatabase",
  5. "user":"root",
  6. "password":"root",
  7. "sql":"SELECT id as _id, id, name,email FROM test",
  8. "index":"users",
  9. "type":"users",
  10. "autocommit":"true",
  11. "metrics": {
  12. "enabled" : true
  13. },
  14. "elasticsearch" : {
  15. "cluster" : "my-application",
  16. "host" : "localhost",
  17. "port" : 9300
  18. }
  19. }
  20. }' | java -cp "/etc/elasticsearch/elasticsearch-jdbc-2.3.4.1/lib/*" -
  21. "Dlog4j.configurationFile=file:////etc/elasticsearch/elasticsearch-jdbc-
  22. 2.3.4.1/bin/log4j2.xml" "org.xbib.tools.Runner"
  23. "org.xbib.tools.JDBCImporter"

为了得到我想要的结果,我已经执行了这个命令:
curl -xgethttp://localhost:9200/users/\u search/?漂亮
这是我得到的结果:

  1. {
  2. "error" : {
  3. "root_cause" : [
  4. {
  5. "type" : "index_not_found_exception",
  6. "reason" : "no such index",
  7. "resource.type" : "index_or_alias",
  8. "resource.id" : "users",
  9. "index_uuid" : "_na_",
  10. "index" : "users"
  11. }
  12. ],
  13. "type" : "index_not_found_exception",
  14. "reason" : "no such index",
  15. "resource.type" : "index_or_alias",
  16. "resource.id" : "users",
  17. "index_uuid" : "_na_",
  18. "index" : "users"
  19. },
  20. "status" : 404
  21. }

任何人都知道这个错误。谢谢你的帮助。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题