es - elasticsearch mapping - parameters - store

148 阅读1分钟

世界上并没有完美的程序,但是我们并不因此而沮丧,因为写程序就是一个不断追求完美的过程。

问 :store有什么特点?
答 :
在这里插入图片描述
问 :store如何使用?
答 :
详细实用可以参考 :
blog.csdn.net/a1366208071…

# store
PUT /store_test 
{
  "mappings" : {
    "properties" : {
      "name" : {
        "type"  : "text",
        "store" : true
      },
      "content" : {
        "type"  : "text",
        "store" : false 
      }
    }
  }
}

# 索引
POST /store_test/_doc/1
{
  "name" : "hello good me"
}

# 搜索
GET /store_test/_search
{
  "stored_fields" : ["name"]
}

# 结果
{
  "took" : 391,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 1,
      "relation" : "eq"
    },
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "store_test",
        "_type" : "_doc",
        "_id" : "1",
        "_score" : 1.0,
        "fields" : {
          "name" : [
            "hello good me"
          ]
        }
      }
    ]
  }
}