[英]How to index normalized SQL database for Elasticsearch
I have already indexed a database (SQL) with a single table which is in sync with its Elasticsearch index.我已经用一个与其 Elasticsearch 索引同步的表为数据库 (SQL) 建立了索引。 Now I want to index a database with multiple normalized tables.
现在我想用多个规范化表索引一个数据库。 So, how should I index those tables?
那么,我应该如何索引这些表呢? Should I write multiple JOIN queries in my logstash file during indexing the database tables, or should I index each table one by one and perform multiple index search?
我应该在索引数据库表期间在我的logstash文件中编写多个JOIN查询,还是应该一个一个地索引每个表并执行多个索引搜索? But for second way, I do not know how to form elasticsearch query for the relevant SQL queries.
但是对于第二种方式,我不知道如何为相关的 SQL 查询形成 elasticsearch 查询。 I am new to Elasticsearch.
我是 Elasticsearch 的新手。 So any guidance for the problem would be appreciated.
因此,我们将不胜感激任何有关该问题的指导。 Here I am also attaching the schema of the database.
在这里,我还附加了数据库的架构。 One more thing, I am using PHP client for searching and displaying data.
还有一件事,我正在使用 PHP 客户端来搜索和显示数据。
First of all, everything will depend on how you want to build your indexes in elasticsearch, that is, if you want an index for each table or an index for several tables.首先,一切都取决于您希望如何在 elasticsearch 中构建索引,也就是说,您是否需要为每个表创建索引或为多个表创建索引。
My advice is:我的建议是:
In addition to these points, my recommendation is that you have those tables in a single index, for example, employee, where you can create different nested objects for each entity in the database, such as department, etc. where you could add the code tags and description of each one.除了这些点之外,我的建议是您将这些表放在一个索引中,例如,员工,您可以在其中为数据库中的每个实体创建不同的嵌套对象,例如部门等。您可以在其中添加代码每个标签和描述。 You can check if it has not been clear
您可以检查是否还不清楚
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.