ES相关API备忘(一)

查看所有节点: http://localhost:9200/_cat/nodes?v

查看当前索引数据: http://localhost:9200/myindex/_search?pretty -d

当前mapping: http://localhost:9200/myindex/_mapping

测试分词:http://localhost:9200/myindex/_analyze?pretty&analyzer=ik_smart&text=com.test.123中文 abc ddd        (ik_max_word    ik_smart)

删除索引: curl -XDELETE'http://localhost:9200/myindex

创建索引:curl -XPUT http://10.20.26.119:9200/pafa5log  -d '
 {
   "settings": {
     "analysis": {
       "analyzer": {
         "optimizeIK": {
           "type": "custom",
           "tokenizer": "ik_max_word",
           "filter": [
             "stemmer"
           ]
         }
       }
     }
   }}'

直接在linux命令下执行。或存成文件 执行

创建表结构:

curl -XPOST http://localhost:9200/myindex/loginfo/_mapping -d'{ 
    "loginfo": {
             "_all": {
           "analyzer": "optimizeIK",
           "search_analyzer": "optimizeIK",
           "term_vector": "no", "store": "false"
        },
        "_ttl" : { 
        "enabled" : true, "default" : "3d" 
        },
        "properties": {
        "contextStack":{
        "type": "string", "store": "no",
                "analyzer": "ik_smart", "search_analyzer": "ik_smart",
                "include_in_all": "true"        
        },
          "appName": {
                "type": "string", "store": "no",
                "index": "not_analyzed",
                "include_in_all": "false" 
            },
            "instanceIp": {
                "type": "string",  "store": "no",
               "index": "not_analyzed",
                "include_in_all": "false" 
            },
            "loggerName": {
                "type": "string", "store": "no",
                "analyzer": "optimizeIK",  "search_analyzer": "optimizeIK",
                "include_in_all": "true" 
            },
            "millis": {
                "type": "string",  "store": "no",
                index: "not_analyzed",
                "include_in_all": "true" 
            },
            "level": {
                "type": "string",  "store": "no",
                "index": "not_analyzed",
                "include_in_all": "false" 
            },
            "message": {
                "type": "string",  "store": "no",
                "analyzer": "ik_smart", "search_analyzer": "ik_smart",
                "include_in_all": "true" 
            },
            "thrown":  {
             "type": "string",  "store": "no",
              "index": "not_analyzed",
               "include_in_all": "true" 
           }
            }
        }
    }
}'

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值