ElasticSearch 常用命令

获取前5条记录

/jrtt/shehui/_search

获取前N条记录

/jrtt/shehui/_search?size=N

匹配查询

POST /jrtt/shehui/_search  
{
  "query": {
    "term" : { "title" : "权力的游戏第八季剧透 剧情剧本曝光 维斯特洛大陆上发生了什么" } 
  }
}

获取Index记录总条数

/jrtt/shehui/_count

删除所有记录

POST /jrtt/_delete_by_query  
{
    "query" : { 
        "match_all" : {}
    }
}

删除Mapping

DELETE /jrtt/  

创建mapping

PUT /jrtt/  
{
  "mappings": {
    "shehui" : {
      "properties" : {       
        "title" : {
          "type" :   "string",
          "index":"not_analyzed"
        },
        "content" : {
          "type" :   "string"
        },
        "upload": {
          "type": "text",
          "fielddata": true
        }
      } 
    }
  }
}