What is ElasticSearch?

Elasticsearch, based on Lucene, hides complexity and provides easy to use RESTful APIs, Java APIs (and APIs in other languages).

There is a Elasticsearch legend about a programmer who lost his job and went to London with his wife to take a cooking course. A programmer who was unemployed and wanted to write a recipe search engine for his wife decided that Lucene was too complex, so he developed an open source project called Compass that encapsulated Lucene. Then the programmer got a job working on distributed high performance projects and decided that Compass was not enough so he wrote Elasticsearch to make Lucene a distributed system.

ElasticSearch is a real-time distributed search and analysis engine. It is used for full-text search, structured search, and data analysis.

Full-text retrieval: part of the information in the unstructured data is extracted, reorganized and made into a certain structure, and then the data with a certain structure is searched, so as to achieve the purpose of relatively fast search.

Select * from products where category_id=’ category_id ‘select * from products where category_id=’ category_id’

Data analysis: E-commerce website, which are the top 10 sellers of toothpaste in the last 7 days? News website, the recent 1 month visits ranked the top 3 news section is what.


Laravel + ES:

Elasticsearch (Elasticsearch

1) ElasticSearch is not a new technology, it is mainly a combination of full-text search, data analysis and distributed technologies to form a unique ES. Lucene (full text search), commercial data analysis software (available), distributed database (MyCAT)

2) The database functionality is inadequate for many areas (transactions, and various online transactional operations); Special functions, such as full text search, synonym processing, relevance ranking, complex data analysis, near real-time processing of massive data; As a supplement to traditional databases, ElasticSearch provides many features that databases do not

What is Full-Text Search and Lucene?

1) Full-text search, inverted index

Full-text retrieval refers to a retrieval method in which computer indexing program scans every word in the article and establishes an index for each word, indicating the number and location of the word in the article. When the user queries, the indexing program searches according to the established index in advance and feeds back the search results to the user. This process is similar to that of looking up words through a word table in a dictionary. Full-text search data in a search engine database.

2) Lucene is a JAR package that contains encapsulated code for building inverted indexes and searching, including algorithms. We use Java development, the introduction of Lucene JAR, and then based on the Lucene API to develop can be.

Four,Analogy between ElasticSearch and Database

Elasticsearch is a way to save data and search for it