命令一:获取索引库里面的数据量
GET feed/_count
命令二:获取索引库 feed里面的所有数据
GET feed/_search
{
"query": {
"match_all": {}
}
}
命令三:获取固定长度的数据
GET feed/_search
{
"query": {
"match_all": {}
},
"_source":"title",
"size":700
}
命令四:profile:true 来开启profile API
GET ecloud_base/_search
{
"profile": "true",
"query": {
"bool": {
"must": [
{
"match": {
"title": "管理"
}
}
],
"filter": {
"query_string": {
"query": "(user_right: \"weidduo\" OR user_right: \"hanxiaohong@baidu.com\") AND (-fileType_i_s:1) "
}
}
}
}
}
命令五:查看search template的语法
GET _scripts/doc_search_v2
命令六:通过fid进行查询
GET ecloud_new/_search
{
"query": {
"term": {
"docId": {
"value": "200907218"
}
}
}
}
另一种方式
GET ecloud_new/_search
{
"query": {
"match": {
"docId":"200907218"
}
},
"stored_fields": ["*"]
}
命令七:多个限制条件查询
GET ecloud_new/_search
{
"query": {
"query_string": {
"query": "(tp:11) AND (msg:说话)"
}
},
"stored_fields": ["*"]
}
命令八:查看query分词
GET ecloud_new/_analyze
{
"field": "linkTitle_tt",
"text": ["淘宝网 - 淘!我喜欢"]
}
命令九:修改es默认获取数据量
es默认最多获取数据10000个,可以对齐设置获取更多
PUT ecloud_new/_settings
{
"index":{
"max_result_window":50000
}
}
网友评论