ES Main concepts of data architecture and relational database Mysql contrast

Here is a picture description

(1) Database in relational database (DataBase), Equivalent to ES Index in (Index)

(2) Under a database, there are N Table (Table), Equivalent to 1 Indexes Index There are N Multi type (Type),

(3) A database table (Table) The data under the (ROW) Multi column (column, attribute ) form , Equivalent to 1 individual Type By multiple documents (Document) He Duo Field form .

(4) In a relational database ,schema The table is defined , Fields for each table , There is also the relationship between tables and fields .
Corresponding , stay ES in :Mapping Define the Type Field processing rules for , That is, how to establish the index , Index type , Do you want to save the original index JSON file , Is the original compressed JSON file , Do we need word segmentation , How to deal with word segmentation .

(5) Add in database insert, Delete delete, change update, check search The operation is equivalent to ES Increase in PUT/POST, Delete Delete, change _update, check GET.


ES Application scenarios of

Usually we have two problems :

1) Try to use the new system development ES As a storage and retrieval server ;

2) The existing system upgrade needs to support full-text retrieval service , Need to use ES.


ES Not a database , It is suitable for massive data , Data with low update frequency (ES There is no transaction and it is not suitable for processing parallel change data ).

ES It is more suitable to deal with data with relatively simple and stable relationship , Some data with complex relationships are used mysql Such a relational database uses sql It's easy to implement , however es It's quite complicated . 

I'm trying to record millions of data in two databases involving two tables : I hope to do further analysis on the application of the two databases from the perspective of implementation and performance through some more specific demand scenarios .

Multi field query and two table associated query

ES It supports multi condition filtering and query for multiple fields in the same table at the same time . There's nothing to say about that .

For two table queries, for example :


classID className 

1           Class name


stuID   classID stuName

1         class ID     Student name

I want to check 1 The names of all the students in the class . This is very important for mysql It's very easy to implement .

about ES It can be used “ Nested objects Nested”. From the data structure, it is in the following form json object

  stuID: 1,

  stuName: Liu Ming ,

   classInfo:  // If a student is only in one class, this object array is not needed. Here is just to illustrate the implementation

  [ {

      classID: 1,

      className: Magic class



      classID: 2,

      className: Science and technology class









©2020 ioDraw All rights reserved
Self made whole person computer program PHP call shell command python Simple record of network programming layui.table Examples of dynamically getting header and list data Big data environment --- data warehouse (hive+mysql+hadoop) The construction of What are the types of variables ?MYSQL database DML Common commands 《 From machine learning to deep learning 》 note (2) Unsupervised learning log4j Method of printing exception stack information Android Development — Display food information according to customer budget