浏览到:http://127.0.0.1:9200/wham/_search
给我:IndexMissingException [砰]失踪
{
"error": "IndexMissingException[[wham] missing]",
"status": 404
}
我根据这些单证设置好一切:
- http://blog.comperiosearch.com/blog/2014/01/30/elasticsearch-indexing-sql-databases-the-easy-way/
- https://github.com/jprante/elasticsearch-river-jdbc
- https://github.com/jprante/elasticsearch-river-jdbc/wiki/Step-by-step-recipe-for-setting-up-the-river-with-PostgreSQL
- How to use Elastic Search on top of a pre-existing SQL Database?
最后一个是目前最有帮助的。
那伤心,我已经通过卷曲使用两种不同的“设置”查询创建我的河流:
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查询中获得所有结果吗?
您需要点击http://127.0.0.1:9200/_river/wham/_search,_river是您的索引名称,wham是您的类型。 –