zoukankan      html  css  js  c++  java
  • ElasticSearch 基本操作

    1.创建索引
    put:http://localhost:9201/test1
    {
    "mappings": {
    "properties": {
    "id": {
    "type": "long",
    "store": true
    },
    "name": {
    "type": "text",
    "store": true
    },
    "title": {
    "type": "text",
    "store": true
    }
    }
    }
    }

    ---------------------------------------------------------------------------------------
    2.新增文档
    put:http://localhost:9201/test1/_doc
    {
    "id": 10,
    "name": "a1",
    "title": "a111"
    }
    ---------------------------------------------------------------------------------------
    3.更新文档
    put:http://localhost:9201/test1/_doc/pBuX7H0B4LNU61os9ujP
    {
    "id": 20,
    "name": "进贤县222",
    "title": "南昌市进贤县22"
    }

    ---------------------------------------------------------------------------------------

    4.删除文档
    delete:http://localhost:9201/test1/_doc/oxuX7H0B4LNU61osLuhW

    5.查询文档1
    get:http://localhost:9201/test1/_doc/pBuX7H0B4LNU61os9ujP

    6.查询文档2
    post:http://localhost:9201/test1/_doc/_search
    {
    "query":{
    "match_all":{}
    }
    }

    --------------------------------------------------------------------------------
    7.查询文档3
    post:http://localhost:9201/test1/_doc/_search
    {
    "query":{
    "match":{
    "title":"b111"
    }
    }
    }
    -----------------
    {
    "query":{
    "match":{
    "title":"b111"
    }
    },
    "sort":{
    "id":{
    "order":"desc"
    }
    }
    }
    -----------------
    {
    "from":0,
    "size":2,
    "query":{
    "match":{
    "title":"b111"
    }
    },
    "sort":{
    "id":{
    "order":"desc"
    }
    }
    }

     

  • 相关阅读:
    html5--6-56 阶段练习5-翻转效果
    html5--6-55 动画效果-关键帧动画
    html5--6-53 阶段练习4-画廊
    html5--6-52 动画效果-过渡
    navicat常用快捷键
    Mysql语句示例
    mysql语句大全
    intellij IDEA怎样打war包
    如何将java web项目上线/部署到公网
    jsp的4大作用域
  • 原文地址:https://www.cnblogs.com/ligenyun/p/15729455.html
Copyright © 2011-2022 走看看