elasticsearch 当_source.enabled=false时,无法在结果中查看指定的字段,elasticsearch,indexing,mapping,elasticsearch,Indexing,Mapping" /> elasticsearch 当_source.enabled=false时,无法在结果中查看指定的字段,elasticsearch,indexing,mapping,elasticsearch,Indexing,Mapping" />

elasticsearch 当_source.enabled=false时,无法在结果中查看指定的字段

elasticsearch 当_source.enabled=false时,无法在结果中查看指定的字段,elasticsearch,indexing,mapping,elasticsearch,Indexing,Mapping,我正在尝试为Elasticsearch 6.7创建映射,但当我得到一条记录时,除非启用_source,否则我看不到任何映射的字段 我举了以下例子: PUT xyz { "mappings":{ "_doc":{ "_source": { "enabled": false }, "properties":{ "raw":{ "type": "text", "store": tru

我正在尝试为Elasticsearch 6.7创建映射,但当我得到一条记录时,除非启用_source,否则我看不到任何映射的字段

我举了以下例子:

PUT xyz
{
  "mappings":{
    "_doc":{
      "_source": {
        "enabled": false
      },
      "properties":{
        "raw":{
          "type": "text",
          "store": true
        }
      }
    }
  }
}

PUT xyz/_doc/123
{"raw":"hello"}

GET xyz/_doc/123
但是
GET
的结果是:

{
  "_index": "xyz",
  "_type": "_doc",
  "_id": "123",
  "_version": 1,
  "found": true
}
我的期望是,我会得到一个包含我想要存储的字段的结果,但显然我遗漏了什么

{
  "_index": "xyz",
  "_type": "_doc",
  "_id": "123",
  "_version": 1,
  "found": true,
  "raw": "hello"
}

您仍然需要请求要查看的内容,如下所示:

GET xyz/_doc/123?stored_fields=raw
然后你会看到:

{
  "_index" : "xyz",
  "_type" : "_doc",
  "_id" : "123",
  "_version" : 1,
  "_seq_no" : 0,
  "_primary_term" : 1,
  "found" : true,
  "fields" : {
    "raw" : [
      "hello"
    ]
  }
}

您仍然需要请求要查看的内容,如下所示:

GET xyz/_doc/123?stored_fields=raw
然后你会看到:

{
  "_index" : "xyz",
  "_type" : "_doc",
  "_id" : "123",
  "_version" : 1,
  "_seq_no" : 0,
  "_primary_term" : 1,
  "found" : true,
  "fields" : {
    "raw" : [
      "hello"
    ]
  }
}

运气好吗?运气好吗?