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

lsticserach 7.6.1 常用数据查询语句

时间:2020-03-13 18:45:13      阅读:65      评论:0      收藏:0      [点我收藏+]

标签:bsp   esc   oca   highlight   des   数据   script   arc   test   

1、创建索引 ( index)

 

curl   -H‘Content-Type: application/json‘ -XPUT http://127.0.0.1:9200/test_index/_doc/1  -d‘{
"mappings": {
  "properties": {
    "title": { "type": "text", "analyzer": "ik_smart" }, 
    "description": { "type": "text", "analyzer": "ik_smart" },
    "price": { "type": "scaled_float", "scaling_factor": 100 }
  }
}}‘

  

 

2、增加内容

    

curl -H‘Content-Type: application/json‘ -XPUT http://127.0.0.1:9200/test_index/_doc/1?pretty -d‘{
    "title": "iPhone X",
    "description": "新品到货",
    "price": 8848
}‘

curl -H‘Content-Type: application/json‘ -XPUT http://127.0.0.1:9200/test_index/_doc/2?pretty -d‘{
    "title": "OPPO R15",
    "description": "新品到货",
    "price": 2000
}‘

  

3、查询记录

    

curl -XPOST -H‘Content-Type:application/json‘ http://localhost:9200/test_index/_doc/_search?pretty -d‘
{
    "query" : { "match" : { "description" : "新" }}
 }‘

4、获得单个记录

  

curl http://localhost:9200/test_index/_doc/1?pretty

  

 

lsticserach 7.6.1 常用数据查询语句

标签:bsp   esc   oca   highlight   des   数据   script   arc   test   

原文地址:https://www.cnblogs.com/fogwang/p/12487828.html

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