久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      總結(jié)ElasticSearch基本操作!非常詳細(xì)!

      es下載地址
      IK分詞器下載地址

      索引

      • 創(chuàng)建索引
        對比關(guān)系型數(shù)據(jù)庫,創(chuàng)建索引就等同創(chuàng)建數(shù)據(jù)庫
          PUT請求   http://127.0.0.1:9200/shopping
        登錄后復(fù)制

      • 查詢索引
          GET請求   http://127.0.0.1:9200/shopping
        登錄后復(fù)制

      • 查詢所有索引
          GET請求   http://127.0.0.1:9200/_cat/indices?v
        登錄后復(fù)制

      • 刪除索引
          DELETE請求   http://127.0.0.1:9200/shopping
        登錄后復(fù)制

      文檔

      索引已經(jīng)創(chuàng)建好了,接下來我們創(chuàng)建文檔,并添加數(shù)據(jù)。這里的文檔可以類比為關(guān)系型數(shù)據(jù)庫中的表數(shù)據(jù),添加的數(shù)據(jù)格式為JSON格式

      • 創(chuàng)建文檔

          POST請求   http://127.0.0.1:9200/shopping/_doc #寫法一   http://127.0.0.1:9200/shopping/_create # 寫法二  {"name":"商品"}
        登錄后復(fù)制

          PUT請求,主鍵必須冪等性   http://127.0.0.1:9200/shopping/_doc/1001 #寫法一   http://127.0.0.1:9200/shopping/_create/1002 # 寫法二  {"name":"商品"}
        登錄后復(fù)制

          POST請求 ,創(chuàng)建自定義id   http://127.0.0.1:9200/shopping/_doc/1001
        登錄后復(fù)制

      • 主鍵查詢

          GET請求   http://127.0.0.1:9200/shopping/_doc/1001
        登錄后復(fù)制

      • 全查詢

          GET請求   http://127.0.0.1:9200/shopping/_search
        登錄后復(fù)制

      • 全量修改

          PUT請求   http://127.0.0.1:9200/shopping/_doc/1001   {"name":"商品"}
        登錄后復(fù)制

      • 局部修改

          POST請求   http://127.0.0.1:9200/shopping/_update/1001   {"doc":{"name":"局部修改商品"}}
        登錄后復(fù)制

      • 刪除

          DELETE請求   http://127.0.0.1:9200/shopping/_doc/1001
        登錄后復(fù)制

        查詢

      • 條件查詢

          GET請求,方法一   http://127.0.0.1:9200/shopping/_search?q=category:小米   http://127.0.0.1:9200/shopping/_search?q=name:商品
        登錄后復(fù)制

          GET請求,方法二(推薦)   http://127.0.0.1:9200/shopping/_search  {       "query":{           "match":{               "category":"小米"           }       }   }
        登錄后復(fù)制

      • 全量查詢

          GET請求   http://127.0.0.1:9200/shopping/_search  {       "query":{           "match_all":{           }       }   }
        登錄后復(fù)制

      • 分頁查詢(from,size)

          GET請求   http://127.0.0.1:9200/shopping/_search  {       "query":{           "match_all":{           }       },       "from":0,#起始位置/偏移量 ,公式:(頁碼-1)* 每頁數(shù)據(jù)條數(shù)      "size":10,#每頁查詢10條  }
        登錄后復(fù)制

      • 指定field分頁查詢 (_source)

          GET請求   http://127.0.0.1:9200/shopping/_search  {       "query":{           "match_all":{           }       },       "from":0,#起始位置/偏移量 ,公式:(頁碼-1)* 每頁數(shù)據(jù)條數(shù)      "size":10,#每頁查詢10條      "_source":["title"]   }
        登錄后復(fù)制

        查詢排序(sort)

          GET請求   http://127.0.0.1:9200/shopping/_search  {       "query":{           "match_all":{           }       },       "from":0,#起始位置/偏移量 ,公式:(頁碼-1)* 每頁數(shù)據(jù)條數(shù)      "size":10,#每頁查詢10條      "_source":["title"],       "sort":{           "price":{               "order":"desc"           }       }   }
        登錄后復(fù)制

        多條件查詢

      • and查詢(must)

          GET請求   http://127.0.0.1:9200/shopping/_search  {       "query":{           "bool":{               "must":[                    {                       "match":{                           "category":"小米"                       }                   },                   {                       "match":{                           "price":1999.00                       }                   }               ]           }       }   }
        登錄后復(fù)制

      • or查詢(should)

          GET請求   http://127.0.0.1:9200/shopping/_search  {       "query":{           "bool":{               "should":[                    {                       "match":{                           "category":"小米"                       }                   },                   {                       "match":{                           "price":1999.00                       }                   }               ]           }       }   }
        登錄后復(fù)制

      • 范圍查詢(filter,range)

          GET請求   http://127.0.0.1:9200/shopping/_search  {       "query":{           "bool":{               "should":[                   {                       "match":{                           "category":"小米"                       }                   },                   {                       "match":{                           "price":1999.00                       }                   }               ],               "filter":{                   "range":{                       "price":{                           "gt":5000                       }                   }               }           }       }   }
        登錄后復(fù)制

      • 全文檢索匹配(分詞)(match)

          GET請求   http://127.0.0.1:9200/shopping/_search  {       "query":{           "match":{               "category": "小華"           }       }   }
        登錄后復(fù)制

      • 完全匹配(match_phrase)

          GET請求   http://127.0.0.1:9200/shopping/_search  {       "query":{           "match_phrase":{               "category": "小華"           }       }   }
        登錄后復(fù)制

      • 高亮查詢 (hightlight,對結(jié)果加html標(biāo)簽)

          GET請求   http://127.0.0.1:9200/shopping/_search  {       "query":{           "match_phrase":{               "category": "小華"           }       },       "hightlight":{           "fields":{               "category":{}           }       }   }
        登錄后復(fù)制

        聚合查詢

      • 返回統(tǒng)計數(shù)據(jù)和原始數(shù)據(jù)

          GET請求   http://127.0.0.1:9200/shopping/_search  {        "aggs":{ #聚合操作          "price_group":{ #名稱,隨意起名              "terms":{ #分組                  "field":"price" #分組字段              }           }       },  }
        登錄后復(fù)制

      • 關(guān)閉原始數(shù)據(jù)(size)

          GET請求   http://127.0.0.1:9200/shopping/_search      {        "aggs":{ #聚合操作          "price_group":{ #名稱,隨意起名              "terms":{ #分組                  "field":"price" #分組字段              }           }       },      "size":0   }
        登錄后復(fù)制

      • 平均值

          GET請求   http://127.0.0.1:9200/shopping/_search      {        "aggs":{ #聚合操作          "price_avg":{ #名稱,隨意起名              "age":{ #平均值                  "field":"price" #分組字段              }           }       },      "size":0   }
        登錄后復(fù)制

        映射關(guān)系

      • 創(chuàng)建映射

          PUT請求   http://127.0.0.1:9200/user/_mapping  {        "properties":{           "name":{               "type":"text", #全文檢索分詞查詢              "index":true           },           "sex":{               "type":"keyword",#完全查詢              "index":true           },           "tel":{               "type":"keyword",#不能查詢              "index":false           }       }   }
        登錄后復(fù)制

      • 查詢映射

          GET請求   http://127.0.0.1:9200/user/_mapping
        登錄后復(fù)制

      • 增加數(shù)據(jù)

          PUT請求   http://127.0.0.1:9200/user/_create/1001   {       name:"小米",       sex:"男的",       tel:"10010"   }
        登錄后復(fù)制

      • 查詢數(shù)據(jù)

          GET請求   http://127.0.0.1:9200/user/_search  {       "query":{           "match": {               name:"小"           }       }   }
        登錄后復(fù)制

          GET請求   http://127.0.0.1:9200/user/_search  {       "query":{           "match": {               sex:"男" #查詢不到,必須輸入男的          }       }   }
        登錄后復(fù)制

          #不支持查詢  GET請求   http://127.0.0.1:9200/user/_search  {       "query":{           "match": {               tel:"10010"            }       }   }
        登錄后復(fù)制

      php入門到就業(yè)線上直播課:立即學(xué)習(xí)
      全程直播 + 實(shí)戰(zhàn)授課 + 邊學(xué) + 邊練 + 邊輔導(dǎo)

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號