一共6种:
1. query string serch
2. query DSL
3. query filter
4. full-text search
5. phrase search
6. highlight search
一,query stringsearch:
概念:所有的search查询都是在http请求后面跟上query string来构建的。
缺点:对复杂的查询语句很难构建。
1. GET school3/student2/_search //查询所有的数据。
返回数据结构名词:
Took:返回数据毫秒数。
timed_ou:是否超时。
_shards:5个分片,相当于数据被拆成了5份,分别在每个分片上,当我们进行搜索时,会去这5个分片上搜索,或者去它们对应的replica上搜索。
Hits.total:返回的document总条数。
Hits.max_score:对于 一个serch的匹配度。
Hits.hits:返回的document的详细数据。
{
"took": 106,
"timed_out":false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total":2,
"max_score": 1,
"hits": [
{
"_index":"school3",
"_type":"student2",
"_id":"AWLxic8IWUX9wu-fMfJ_",
"_score": 1,
"_source": {
"id":"1",
"name": "少将",
"addreess": "金牛区",