ElasticSearch Tutorial: Searching Documents

1. Query the document according to the course id

Send: get http://localhost:9200/xc_course/doc/4028e58161bcf7f40161bcf8b77c0000
test with postman:
insert image description here

2. Query all records

send gethttp://localhost:9200/xc_course/doc/_search

3. Query the records that include the spring keyword in the name

send: gethttp://localhost:9200/xc_course/doc/_search?q=name:bootstrap

4. Query the records whose learning mode is 201001

send gethttp://localhost:9200/xc_course/doc/_search?q=studymodel:201001

Query result analysis

Analyze the above query results:

{
    
    
	"took": 1,
	"timed_out": false,
	"_shards": {
    
    
		"total": 1,
		"successful": 1,
		"skipped": 0,
		"failed": 0
	},
	"hits": {
    
    
		"total": 1,
		"max_score": 0.2876821,
		"hits": [
			{
    
    
				"_index": "xc_course",
				"_type": "doc",
				"_id": "4028e58161bcf7f40161bcf8b77c0000",
				"_score": 0.2876821,
				"_source": {
    
    
					"name": "Bootstrap开发框架",
					"description": "Bootstrap是由Twitter推出的一个前台页面开发框架,在行业之中使用较为广泛。此开发框架包含了大量的CSS、JS程序代码,可以帮助开发者(尤其是不擅长页面开发的程序人员)轻松的实现一个不受浏览器限制的精美界面效果。",
					"studymodel": "201001"
				}
			}
		]
	}
}
  • took: the time spent on this operation, in milliseconds.
  • timed_out: whether the request timed out
  • _shards: Indicates which shards were searched in this operation
  • hits: records hit by the search
  • hits.total: the total number of eligible documents hits.hits: the first N documents with a high matching degree
  • hits.max_score: document matching score, here is the highest score
  • _score: Each document has a match score, sorted in descending order.
  • _source: Shows the original content of the document.

Guess you like

Origin blog.csdn.net/a772304419/article/details/132383644