This is the 11th day of my participation in the August More text Challenge. For details, see: August More Text Challenge

If ❤️ my article is helpful, welcome to like, follow. This is the greatest encouragement for me to continue my technical creation. More past articles in my personal column

Search API

  • URI Search: Indicates that the URI contains parameters
  • Request Body Search: ES provides a more complete DSL based on the JSON format

Specifying the query index

  • /_search: all indexes on the cluster
  • /index1,index2/_doc/_search: index1,index2 index
  • /index*/_doc/_search: index starting with index

Response after request

  • He took time
  • Total: indicates the total number of documents that meet the condition
  • Hits: results set, top 10 by default
  • _source: the original information of the document

Search relevance

  • Search is a conversation between the user and the search engine
  • Relevance of user relationship search results
    • Can you find the search related content
    • How many pieces of relevant content have been returned
    • Whether the document is graded properly
    • Balance results rankings with business needs

Page Rank algorithm

  • It’s not just the content
  • More important is content credibility

Website search engine, in fact, is the role of sales

  • Increase sales
  • Get rid of the inventory

Measuring correlation

  • Precision rate – Return as few irrelevant documents as possible
  • Recall – Return as many relevant documents as possible
  • Rank – Whether you can rank by relevance

Basic CRUD and batch operations for documents

Course Demo

############Create Document############ #create document. _id POST users/_doc {"user" : "Mike", "post_date" : "2019-04-15T14:12:12", "message" : "trying out Kibana" } #create document. Specify the Id. PUT users/_doc/1? op_type=create { "user" : "Jack", "post_date" : "2019-05-15T14:12:12", "message" : "trying out Elasticsearch" } #create document. PUT users/_create/1 {"user" : "Jack", "post_date" : "2019-05-15T14:12:12", "message" : "2019-05-15T14:12:12", "message" : "trying out Elasticsearch" } ### Get Document by ID #Get the document by ID GET users/_doc/1 ### Index & Update #Update GET users/_doc/1 PUT users/_doc/1 {"user" : POST users/_update/1/ {"doc":{"post_date" : "2019-05-15T14:12:12", "message" : "Trying out Elasticsearch"}} ### Delete by Id # Delete users/_doc/1 POST _bulk {"index" : {"_index" : "test", "_id" : "1"}} {"field1" : "value1"} {"delete" : { "_index" : "test", "_id" : "2" } } { "create" : { "_index" : "test2", "_id" : "3" } } { "field1" : "value3" } { "update" : {"_id" : "1", "_index" : "test"} } { "doc" : {"field2" : "Value2"}} # perform second POST _bulk {" index ": {" _index" : "test", "_id" : "1"}} {" field1 ":" value1} {" delete ": { "_index" : "test", "_id" : "2" } } { "create" : { "_index" : "test2", "_id" : "3" } } { "field1" : "value3" } { "update" : {"_id" : "1", "_index" : "test"} } { "doc" : {"field2" : "Value2"}} # # # mget operations GET / _mget {" docs ": [{" _index" : "test", "_id" : "1"}, {" _index ":" test ", "_id" : "2"}}] # URI specified in the index GET/test / _mget {" docs ": [{" _id" : "1"}, {" _id ":" 2 "}]} GET / _mget {" docs ": [ { "_index" : "test", "_id" : "1", "_source" : false }, { "_index" : "test", "_id" : "2", "_source" : ["field3", "field4"] }, { "_index" : "test", "_id" : "3", "_source" : { "include": ["user"], "exclude": ["user. Location "]}}]} ### ecommerce/_msearch {} {"query" : {"match_all" : {}},"size":1} {"index" : "kibana_sample_data_flights"} {"query" : {"match_all" : {}},"size":2} ### DELETE users DELETE test DELETE test2Copy the code

reading

  • The Document API www.elastic.co/guide/en/el…
  • www.elastic.co/guide/en/el…
  • Searchenginewatch.com/sew/news/20…
  • www.huffpost.com/entry/searc…
  • www.entrepreneur.com/article/176…
  • www.searchtechnologies.com/meaning-of-…
  • Baike.baidu.com/item/%E6%90…