“This is the seventh day of my participation in the August More Text Challenge. For details, see: August More Text Challenge.”

Distributed, full-text search engine based on open source:

ELastic search

Website: www.elastic.co/cn/

Download: www.elastic.co/cn/download…

Mainly used for data search, dynamic query. Data filtering etc. ‘;

Data are divided into:

Structured data in the form of a two-dimensional table

Unstructured data, ICONS

Semi-structured data HTML, CSS. And other language information

Start downloading:

Decompress after downloading:

http://localhost:9200 9200 is a startup port for the client

Port 9300 is used for communication between components in the Elasticsearch cluster. Port 9200 is used for HTTP access by the browser

Protocol RESTful port.

Indicates the startup is complete.

Take bin/ elssticsearche.bat and then request the data to an address http://localhost:9200

Es is successfully started, indicating that Elastic Search is successfully started.

Es is developed with RESTful principles and is idempotent, but POST is not

Resource transformation, request;

JSON format

Javascript object  notation

var obj={ "name":"lucas"}`
Copy the code

JSON string: Indicates that the format of the string passed through the network conforms to the JSON format

Inverted index:

Es basic operation:

Create index(mysql database)

  

Create index :(put request occurs)

 

http://localhost:9200/shopping said put request creation, specific to idempotence, create many times with the same name will be the same, for esCopy the code

Es supports Get, PUT, DELETE for indexes,

 

View information about the current index:

http://localhost:9200/shopping
Copy the code

Copy the code

Query information about all indexes:

 http://localhost:9200/_cat/indices?v
Copy the code

Delete current index:

 http://localhost:9200/shopping
Copy the code

 

Create a document:

 

 http://localhost:9200/shopping/_doc
Copy the code

 

{" title ":" millet mobile phone ", "category" : "millet", "images" : "http://www.gulixueyuan.com/xm.jpg", "price" : 3999.00}Copy the code

{" _index "[index] :" shopping ", "_type" [type - document] : "_doc", "_id" : a unique identifier 】 【 "Xhsa2ncBlvF_7lxyCE9G", # can be likened to MySQL primary key, randomly generate "_version" : 1, "result" : "_shards" : {"total" : 2, "successful" : 1, "failed" : {"successful" : 1, "failed" : 0 }, "_seq_no": 0, "_primary_term": 1 }Copy the code

There is a unique identification above; It can also be customized based on

 

 http://localhost:9200/shopping/_doc/1001    post
Copy the code
 http://localhost:9200/shopping/create/1002   put
Copy the code

To view your document data:

 http://localhost:9200/shopping/_doc/1001   get
Copy the code

How to query all documents in the current index?

 http://localhost:9200/shopping/_search
Copy the code

Put/is a full update

Post is a local update;

Delete a document: