elasticsearch 笔记

为shop 索引添加映射

POST http://10.4.7.150:9200/shop/_mapping

请求体:

  

{
    "properties" : {
        "id":{
            "type":"long"
        },
        "age":{
            "type":"integer"
        },
        "username":{
            "type":"keyword"
        },
        "nickname":{
            "type":"text",
            "analyzer":"ik_max_word"
        },
        "money" : {
            "type":"float"
        },
        "desc":{
            "type":"text",
            "analyzer":"ik_max_word"
        },
        "sex": {
            "type":"byte"
        },
        "birthday":{
            "type":"date"
        },
        "face":{
            "type":"text",
            "index":false
        }

    }
}

  

 

//类似 MySQL SELECT id,username FROM shop:

POST http://10.4.7.150:9200/shop/_doc/_search

请求体:
   {
    "query" : {
        "match_all" : {
            
        }
    },
    "_source" : [
        "id",
        "username"
    ]
}

  

 

posted @ 2020-08-27 10:49  shijiu520  阅读(108)  评论(0)    收藏  举报