如何在预先存在的SQL数据库之上使用弹性搜索? [英] How to use Elastic Search on top of a pre-existing SQL Database?
问题描述
I've been reading through a lot of good documentation about how to implement Elastic Search on a website with javascript or PHP.
我已经阅读了很多很好的文档,了解如何使用javascript或PHP在网站上实现弹性搜索。 http://www.elasticsearchtutorial.com/basic-elasticsearch-concepts.html\">引入ES 。
Very good introduction to ES.
整个 CRUD 。
Elastic search with PHP: here, here, and here.
所以原因为什么我给你这些URL是下面的在使用一个预先存在的SQL DB的时候,应该如何使用这些很好的文档中的一个或多个。
So the reason why I'm giving you those URLs is to understand how to use one or many of those great documentations when having a pre-existing SQL DB.
我在这里没有提到这一点:正如他们所说的,Elasticsearch将创建它自己的索引和数据库与MongoDB,我不明白如何使用我的(巨人)数据库使用SQL?假设我有一个MySQL数据库,我想使用Elasticsearch更快地进行研究,并提出用户预先做的查询,我该如何做? MySQL如何在MySQL上运行?如何将这个巨大的数据集(超过8GB)转移到ES DB中,以便在开始时完全有效?
I'm missing the point somewhere: As they said Elasticsearch will create its own indexes and DB with MongoDB, I don't understand how can I use my (gigantic) database using SQL? Let say I have a MySQL DB, and I would like to use Elasticsearch to make my research faster and to propose the user pre-made queries, how do I do that? How does ES works over/along MySQL? How to transfer this gigantic set of Datas (over 8GB) into ES DB in order to be fully efficient at the beginning?
非常感谢
推荐答案
我正在使用 jdbc-river w / mysql。这是非常快的您可以将其配置为持续轮询数据,或使用一次性(一次性策略)导入。
I am using jdbc-river w/ mysql. It is very fast. You can configure them to continually poll data, or use one-time (one-shot strategy) imports.
例如
curl -xPUT http://es-server:9200/_river/my_river/_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",
"driver" : "com.mysql.jdbc.Driver",
"url" : "jdbc:mysql://mysql-server:3306/mydb",
"user" : "root",
"password" : "password*",
"sql" : "select c.id, c.brandCode, c.companyCode from category c"
},
"index" : {
"index" : "mainIndex",
"type" : "category",
"bulk_size" : 30,
"max_bulk_requests" : 100,
"index_settings" : null,
"type_mapping" : null,
"versioning" : false,
"acknowledge" : false
}
}'
这篇关于如何在预先存在的SQL数据库之上使用弹性搜索?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!