ES实战-book笔记1

#索引一个文档,-XPUT手动创建索引,
curl -XPUT 'localhost:9200/get-together/_doc/1?pretty' -H 'Content-Type: application/json' -d '{
  "name": "Elasticsearch Denver",
  "organizer": "Lee"
}'
#返回结果
{
  "_index" : "get-together",
  "_id" : "1",
  "_version" : 2,
  "result" : "updated",
  "_shards" : {
    "total" : 2,
    "successful" : 1,
    "failed" : 0
  },
  "_seq_no" : 1,
  "_primary_term" : 1
}
#kibana 请求
GET /get-together/_search
#响应:
{
  "took": 277,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 1,
      "relation": "eq"
    },
    "max_score": 1,
    "hits": [
      {
        "_index": "get-together",
        "_id": "1",
        "_score": 1,
        "_source": {
          "name": "Elasticsearch Denver",
          "organizer": "Lee"
        }
      }
    ]
  }
}
#在kibana 中获取索引的映射_mapping
GET /get-together/_mapping
#响应:
{
  "get-together": {
    "mappings": {
      "properties": {
        "name": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "organizer": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        }
      }
    }
  }
}

#通过curl获取一个索引的映射_mapping
ES实战-book笔记1_第1张图片

你可能感兴趣的:(elasticsearch,笔记,大数据)