记录一下学习elasticsearch过程,使用kibana客户端练习。【学习积累】

PUT /heima
{
  "settings": {
    "number_of_shards": 1
    , "number_of_replicas": 0
  }
}

GET /heima1

DELETE /heima1

PUT heima/_mapping/goods
{
  "properties": {
    "title": {
      "type": "text",
      "analyzer": "ik_max_word"
    },
    "images": {
      "type": "keyword",
      "index": "false"
    },
    "price": {
      "type": "float"
    }
  }
}

GET /heima/_mapping


POST /heima/goods/3
{
    "title":"超米手机",
    "images":"http://image.leyou.com/12479122.jpg",
    "price":3699.00,
    "saleable": true
}

PUT /heima/goods/4
{
    "title":"小米电视4A",
    "images":"http://image.leyou.com/12479122.jpg",
    "price":3899.00
}

PUT /heima/goods/5
{
    "title":"华为手机",
    "subTitle": "小米",
    "images":"http://image.leyou.com/12479122.jpg",
    "price":3999.00
}

GET /heima/_search
{
    "query":{
        "match_all":{}
    }
}


DELETE /heima/goods/NGGgXm4B1XJkxRhg9ed4


GET /heima/_search
{
  "query": {
    "match": {
      "title": {
        "query": "小米手机电视",
        "minimum_should_match": "30%"
      }
    }
  }
}


GET /heima/_search
{
  "query": {
    "multi_match": {
      "query": "小米",
      "fields": ["title","subTitle"]
    }
  }
}


GET /heima/_search
{
  "query": {
    "term": {
      "title": {
        "value": "小米"
      }
    }
  }
}


GET /heima/_search
{
  "_source": ["title", "price"], 
  "query": {
    "terms": {
      "title": [
        "小米",
        "华为"
      ]
    }
  }
}

GET /heima/_search
{
  "_source": {
    "excludes": "images"
  },
  "query": {
    "terms": {
      "title": [
        "小米",
        "华为"
      ]
    }
  }
}

GET /heima/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "title": "小米"
          }
        },
        {
          "terms": {
            "price": [
              "2799",
              "2699"
            ]
          }
        }
      ]
    }
  }
}

GET /heima/_search
{
  "query": {
    "bool": {
      "should": [
        {
          "match": {
            "title": "小米"
          }
        },
        {
          "terms": {
            "price": [
              "2799",
              "2699"
            ]
          }
        }
      ]
    }
  }
}

GET /heima/_search
{
  "query": {
    "range": {
      "price": {
        "gte": 2699,
        "lte": 3899
      }
    }
  }
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值