https://www.cnblogs.com/yiwangzhibujian/p/7137546.html

 

curl -XPUT http://localhost:9200/shakespeare -d '
{
 "mappings" : {
  "_default_" : {
   "properties" : {
    "speaker" : {"type": "string", "index" : "not_analyzed" },
    "play_name" : {"type": "string", "index" : "not_analyzed" },
    "line_id" : { "type" : "integer" },
    "speech_number" : { "type" : "integer" }
   }
  }
 }
}
'


 curl http://localhost:9200/shakespeare/_mapping?pretty
{
  "shakespeare" : {
    "mappings" : {
      "_default_" : {
        "properties" : {
          "line_id" : {
            "type" : "integer"
          },
          "play_name" : {
            "type" : "keyword"
          },
          "speaker" : {
            "type" : "keyword"
          },
          "speech_number" : {
            "type" : "integer"
          }
        }
      }
    }
  }
}