如何在预先存在的 SQL 数据库之上使用弹性搜索? [英] How to use Elastic Search on top of a pre-existing SQL Database?

查看:26
本文介绍了如何在预先存在的 SQL 数据库之上使用弹性搜索?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了很多关于如何使用 javascript 或 PHP 在网站上实现弹性搜索的优秀文档.

I've been reading through a lot of good documentation about how to implement Elastic Search on a website with javascript or PHP.

非常好的ES简介.

非常完整的文档这里此处.

一个完整的CRUD.

使用 PHP 进行弹性搜索:此处此处此处.

Elastic search with PHP: here, here, and here.

因此,我给您这些 URL 的原因是为了了解在拥有预先存在的 SQL 数据库时如何使用其中一个或多个优秀文档.

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 使我的研究更快,并向用户提出预制查询,我该怎么做?ES 如何在 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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆