2014-03-19 35 views
4

浏览到:http://127.0.0.1:9200/wham/_search
给我:IndexMissingException [砰]失踪

{ 
    "error": "IndexMissingException[[wham] missing]", 
    "status": 404 
} 

我根据这些单证设置好一切:

最后一个是目前最有帮助的。
那伤心,我已经通过卷曲使用两种不同的“设置”查询创建我的河流:

curl -XPUT 'localhost:9200/_river/wham/_meta' -d '{ 
    "type": "jdbc", 
    "jdbc": { 
    "url": "jdbc:postgresql://localhost:5432/testdb", 
    "user": "postgres", 
    "password": "passywordu", 
    "index": "source", 
    "type": "wham", 
    "sql": "select * from testtable;" 
    } 
}' 

然后,我已经试过这也就是上面的最后一个环节的修改版本。

curl -XPUT 'localhost:9200/_river/wham/_meta' -d '{ 
    "type": "jdbc", 
    "jdbc": { 
    "strategy": "simple", 
    "poll": "5s", 
    "scale": 0, 
    "autocommit": false, 
    "fetchsize": 10, 
    "max_rows": 0, 
    "max_retries": 3, 
    "max_retries_wait": "10s", 
    "url": "jdbc:postgresql://localhost:5432/testdb", 
    "user": "postgres", 
    "password": "passywordu", 
    "sql": "select * from testtable", 
    "index": "wham" 
    } 
}' 
我目前使用的最后一个卷发的

http://127.0.0.1:9200/_river/wham/_status给了我这样的:

{ 
    "_index": "_river", 
    "_type": "wham", 
    "_id": "_status", 
    "_version": 4, 
    "found": true, 
    "_source": { 
    "node": { 
     "id": "v1DmcsEOSbKfEbjRdwLYOg", 
     "name": "Miles Warren", 
     "transport_address": "inet[/192.168.43.211:9300]" 
    } 
    } 
} 

所以河水那里,我不过没有看到我的PostgreSQL数据库引擎到达的任何疑问。我已经设置了相应的:

su - postgres 
initdb --locale en_US.UTF-8 -E UTF8 -D '/tmp/testdb' 
postgres -D /tmp/testdb 
createdb testdb 
psql -d testdb 

CREATE TABLE testtable (
    source  varchar(20) NOT NULL, 
    destination varchar(20) NOT NULL, 
    service  int, NOT NULL 
); 

INSERT INTO testtable VALUES('192.168.0.10', '192.168.0.1', 80) 
INSERT INTO testtable VALUES('192.168.0.11', '192.168.0.2', 21) 

我可以查询默认端口上的数据库,它运行良好以及用户名和密码。
我哪里出错了?我误解了elasticsearch,或者我不应该能够做/wham/_search并从所提到的SQL查询中获得所有结果吗?

+0

您需要点击http://127.0.0.1:9200/_river/wham/_search,_river是您的索引名称,wham是您的类型。 –

回答

5

我认为你是混淆查询

查询1)

curl -XPUT 'localhost:9200/_river/wham/_meta' -d '{ 
     "type" : "jdbc", 
     "jdbc" : { 
      "url" : "jdbc:postgresql://localhost:5432/testdb", 
      "user" : "postgres", 
      "password" : "passywordu", 
      "index" : "source", 
      "type" : "wham", 
      "sql" : "select * from testtable;" 
     } 
    }' 

同时使用上面的查询

创建名为 “” 的指标。在那里你创建了一个索引类型的wham。 之后执行curl。您需要使用以下格式查询数据:

http://127.0.0.1:9200/source/wham/_search 

这意味着在索引“source”内输入搜索数据并键入“wham”。

查询2)

curl -XPUT 'localhost:9200/_river/wham/_meta' -d '{ 
"type" : "jdbc", 
"jdbc" : { 
    "strategy" : "simple", 
    "poll" : "5s", 
    "scale" : 0, 
    "autocommit" : false, 
    "fetchsize" : 10, 
    "max_rows" : 0, 
    "max_retries" : 3, 
    "max_retries_wait" : "10s", 
    "url" : "jdbc:postgresql://localhost:5432/testdb", 
    "user" : "postgres", 
    "password" : "passywordu", 
    "sql" : "select * from testtable", 
    "type": "typename", //add the type of documents to be indexed[like tables in RDBMS] 
    "index" : "wham" 
} 
     }' 

同时使用上面的查询

创建名为 “威猛” 的指标。在那里你创建了一个索引类型的wham。 之后执行curl。您需要使用以下格式查询数据:

http://127.0.0.1:9200/wham/typename/_search [or] 
    http://127.0.0.1:9200/wham/_search 

它表示索引“wham”和索引类型“typename”内的搜索数据。

在尝试以上curl.delete _river索引并尝试。如果数据不重要清除数据文件夹并尝试..!

希望它有助于..!

+0

对不起,花了这么长时间才回到你身边,花了一段时间才回到环境并测试了这些东西。我确实混淆了这个格式。你的帮助让我颇为惊讶,因为我甚至感谢你的话语无法形容感恩! ^^ – Torxed