ElasticSearch search tool Kibana use: 1. Visit the Web site: ip + port: for example Kibana installed on the virtual machine configuration: HTTP: // 192.168.211.132:5601 2 Enter the DSL Tools statement Dev:. # Search index GET / _cat / indices? v # create the index usr: PUT / usr # delete the index usr: dELETE / usr # create a mapping UserInfo: PUT / usr / UserInfo / _mapping { "the Properties" : { "name" : { "of the type": "text" , "Analyzer": "ik_smart" , "search_analyzer": "ik_smart" , "store": false }, "city":{ "type": "text", "analyzer": "ik_smart", "search_analyzer": "ik_smart", "store": false }, "age":{ "type": "long", "store": false }, "description":{ "type": "text", "analyzer": "ik_smart", "search_analyzer": "ik_smart", "store": {/ usr / UserInfo /. 1 the PUT=. 1 # new document data ID } } }to false "name": "John Doe" , "Age": 22 , "City": "Shenzhen" , "the Description": "John Doe from Wuhan!" } # new document data the above mentioned id = 2 PUT / usr / UserInfo / 2 { "name": "Wang Wu" , "Age": 35 , "City": "Shenzhen" , "the Description": "! Wang Wu, who lives in Shenzhen" } # new document data the above mentioned id = 3 PUT / usr / UserInfo / 3 { "name": "Joe Smith" , "Age": 19 , "City": "Shenzhen" , "the Description": "Working in Shenzhen, from Wuhan, Hubei " } # new document data the above mentioned id = 4 PUT / usr / UserInfo / 4 { " name ":" Chi Master. ", "Age": 66 , "City": "Wuhan" , "the Description": "! Studying in Wuhan, home in Wuhan" } # new document data the above mentioned id = 5 PUT / usr / UserInfo / 5 { "name": "hero" , "Age": 77 , "City": "Guangzhou" , "the Description": "Zhao Zilong from Shenzhen Baoan, but work in Guangzhou!" , "address": "Maoming City in Guangdong Province" } # new document data ID =. 6 the PUT / usr / UserInfo /. 6 { "name": "Zhao Yi" , "Age": 55 , "City": "Canton" , "description": "Zhao Yi from Guangzhou Baiyun District, engaged in e-commerce for eight years!" } # new document data the above mentioned id = 7 PUT / usr / UserInfo / 7 { "Name": "Zhao Haha" , "Age": 57 , "City": "Wuhan" , "the Description": "! Haha Wuhan Zhao, working in Shenzhen for half a year, a monthly salary of 7500" } # delete a document DELETE usr / UserInfo /. 7 # query data # Search the GET / usr / _search { "query" : { "MATCH_ALL" : { } } } # The ID query the GET / usr / UserInfo / 2 # query sort the GET / usr / _search { "Query" : { "MATCH_ALL" : { } }, "sort": [ { "age": { "order": "desc" } } ] } #分页实现 GET /usr/_search { "query":{ "match_all": {} }, "sort":{ "age":{ "order":"desc" } }, "from": 0, "size": 3 } #过滤查询-term GET _search { "query":{ "term":{ "city":"武汉" { the GET _search- # Filtering query } } } Terms Term allows multiple "Query" : { "Terms" : { "City" : [ "Wuhan" , "Guangzhou" ] } } } # Filter - Range Filter range #gt represents > gte represents => #lt represents <LTE represents < = the GET _search { "Query" : { "Range" : { "Age" : { "GTE": 30 , "LTE":57 } } } } # search filter exists: refers to a domain retrieval data includes the GET _search { "Query": { "EXISTS": { "Field": "address" } } } # prefix matching prefix the GET _search { "Query" : { "prefix" : { "name" : { "value": "Zhao" } } } } # Search Filter BOOL #must: exact match multiple query conditions equivalent to and. #must_not: Instead of matching multiple queries conditions, equivalent to not. #should: At least one query matching, equivalent to or. _Search the GET { "Query" : { "BOOL" : { "MUST" : [ { "Term" : "value": "Shenzhen" } } }, { "Range" : { "Age" : { "GTE": 20 is , "LTE": 99 } } } ] } } } # string matching the GET _search { "Query" : { "match" : { "description": "Wuhan" } } } # plurality of search field matches the GET _search { "Query" : { "multi_match" : { "query": "深圳", "fields": [ "city", "description" ] } } } # 高亮查询 GET user/_search { "query": { "match": { "description": "武汉" } }, "highlight": { "pre_tags": "<span style='color:red'>", "post_tags": "</span>", "fields": { "description": {} } } }