返回 account_number|学习笔记

简介: 快速学习返回 account_number。

开发者学堂课程【ElasticSearch 最新快速入门教程返回 account_number】学习笔记,与课程紧密联系,让用户快速学习知识。

课程地址:https://developer.aliyun.com/learning/course/642/detail/10675


返回 account_number

 

内容介绍:

一、返回 account_number=20

二、address=mill

三、address=mill lane

四、短语搭配 address=mill lane

 

一、返回 account_number=20

curl-XPOST’localhost:9200/bank/search?pretty’-d

‘{

“query”:{match_all”:{}},

“source”:{{“balance”,”account_number”}}

}’

match 查询,可以作为基本字段搜索查询

返回account_number=20:

curl-XPOST’localhost:9200/bank/_search?pretty’-d

‘{

“query”:{“match”:{“account_number”:20}},

}’

查询代码:

{

“query”:{

“match": {

“account_number”:20

}

},

“_source”:{

“_score”,

“balance”

“account_number”

},

“sort”:{

"balance": {

“order":”desc”

}

}

}

查询结果:

image.png

{

"took":111,

"timed_out": false,

“_shards":{

"total":5,

"successful": 5,

"skipped": 0,

"failed":0

},

"hits":{

"total": 1,

"max_score": null,

"hits":{

{

"_index": "bank",

“_type":"account"

“_id":"20",

“_score": null,

“_source":{

"account_number":20,

"balance":16418

}

"sort";{

16418

}

查询所有的,代码如下:

{

“query”:{

“match": {

“account_number”:20

}

},

“sort”:{

"balance": {

“order":”desc”

}

}

}

查询结果:

image.png


二、返回 address=mill

curl-XPOST’localhost:9200/bank/search?pretty’-d

‘{

“query”:{match_all”:{}},

“source”:{{“balance”,”account_number”}}

}’

返回address=mill

curl-XPOST’localhost:9200/bank/_search?pretty’-d

‘{

“query”:{“match”:{“address”:”mill”}},

}

查询代码:

“query”:{

“match": {

“address”:”mill”

}

},

“sort”:{

"balance": {

“order":”desc”

}

}

}

查询结果:

image.png


三、返回 address=mill or address=lane

curl-XPOST’localhost:9200/bank/search?pretty’-d

‘{

“query”:{match_all”:{}},

“source”:{{“balance”,”account_number”}}

}’

返回 address=mill or address=lane

curl-XPOST’localhost:9200/bank/_search?pretty’-d

‘{

“query”:{“match”:{“address”:”mill lane”}},

}

查询代码1:

“query”:{

“match": {

“address”:”mill lane”

}

},

“sort”:{

"balance": {

“order":”desc”

}

}

}

查询结果:

image.png

查询代码2:

“query”:{

“match": {

“address”:”mill lane”

}

},

“sort”:{

"balance": {

“order":”desc”

}

},

“size”:200

}

查询结果:

image.png

 

四、返回 短语搭配 address=mill lane

curl-XPOST’localhost:9200/bank/search?pretty’-d

‘{

“query”:{match_all”:{}},

“_source”:{“balance”,”account_number”}

}’

返回 短语搭配 address=mill lane

curl-XPOST’localhost:9200/bank/_search?pretty’-d

‘{

“query”:{“match_phrase”:{“address”:”mill lane”}},

}

查询代码:

“query”:{

“match": {

“address”:”mill lane”

}

},

“sort”:{

"balance": {

“order":”desc”

}

},

“size”:200

“_source”:{

“balance”,

”account_number”

}

}

查询结果:

image.png

相关文章
解决方案:Missing URI template variable ‘userName‘ for method parameter of type String
解决方案:Missing URI template variable ‘userName‘ for method parameter of type String
|
7月前
|
安全 程序员 C++
C++中的类型查询:探索typeid和type_info
C++中的类型查询:探索typeid和type_info
83 1
|
7月前
|
索引
String index out of range错误与解决方法
String index out of range错误与解决方法
2549 0
|
Java
【ES异常】mapper [sortNum] of different type, current_type [long], merged_type [keyword]
【ES异常】mapper [sortNum] of different type, current_type [long], merged_type [keyword]
165 0
|
人工智能 自然语言处理 语音技术
Invalid prop: type check failed for prop “index“. Expected String with value “5“问题解决
Invalid prop: type check failed for prop “index“. Expected String with value “5“问题解决
157 0
|
存储
Number 类型:
Number 类型:
125 1
|
JSON 数据格式 开发者
返回 account_number and balance | 学习笔记
快速学习返回 account_number and balance
返回 account_number and balance | 学习笔记
TypeError: sequence item 0: expected string, int found
TypeError: sequence item 0: expected string, int found
|
JSON 数据格式 开发者
返回 account_number and balance|学习笔记
快速学习返回 account_number and balance。
101 0