码迷,mamicode.com
首页 > 其他好文 > 详细

ElasticSearch学习

时间:2019-06-12 11:01:35      阅读:105      评论:0      收藏:0      [点我收藏+]

标签:source   arch   pen   lap   排序   splay   desc   value   技术   

ElasticSearch学习

match_all: 全部查询

技术图片
GET dw_app_car_offering_price_ds/_search
{
  "query": {
    "match_all": {}
  }
}
View Code

单个查询

技术图片
GET dw_app_car_offering_price_ds/_search
{
  "query": {
      "term": {
      "model_code": {
        "value": "12550-n"
      }
    }
  }
}
View Code

size:默认10条

技术图片
GET dw_app_car_offering_price_ds/_search
{
  "query": {
      "term": {
      "model_code": {
        "value": "12550-n"
      }
    }
  },
  "size": 20
}
View Code

from  size :从某个from索引的size条数据

技术图片
GET dw_app_car_offering_price_ds/_search
{
  "query": {
      "term": {
      "source": {
        "value": "che168"
      }
    }
  },
  "from": 10, 
  "size": 10
}
View Code

sort  :排序

技术图片
GET dw_app_car_offering_price_ds/_search
{
  "query": {
    "bool": {
      "must": [
        
        {
          "term": {
          "model_code": {
            "value": "201795"
          }
          }
          
        },
        {
          "term": {
            "source": {
              "value": "che168"
            }
          }
        },
        {
          "term": {
            "city_code": {
              "value": "00002"
            }
          }
        }
        
      ]
    }
  },
  "size": 100,
  "sort": [
    {
      "ds": {
        "order": "desc"
      }
    }
  ]
}
View Code

_source:条件查询

技术图片
GET dw_app_car_offering_price_ds/_search
{
  "query": {
      "term": {
      "model_code": {
        "value": "12550-n"
      }
    }
  },
  "_source": ["offering_price_50","city_code"]
}
View Code

 

ElasticSearch学习

标签:source   arch   pen   lap   排序   splay   desc   value   技术   

原文地址:https://www.cnblogs.com/wanghongye/p/10993627.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!