elasticsearch 更新Elasticsearch\u映射中的字符串参数,elasticsearch,mapping,elasticsearch,Mapping" /> elasticsearch 更新Elasticsearch\u映射中的字符串参数,elasticsearch,mapping,elasticsearch,Mapping" />

elasticsearch 更新Elasticsearch\u映射中的字符串参数

elasticsearch 更新Elasticsearch\u映射中的字符串参数,elasticsearch,mapping,elasticsearch,Mapping,我在Elasticsearch6.8中有这样一个\u映射: { "grch38_test__wes__grch38__variants__20210222" : { "mappings" : { "variant" : { "_meta" : { "gencodeVersion" : "25", &

我在
Elasticsearch
6.8
中有这样一个
\u映射

{
  "grch38_test__wes__grch38__variants__20210222" : {
    "mappings" : {
      "variant" : {
        "_meta" : {
          "gencodeVersion" : "25",
          "hail_version" : "0.2.20",
          "genomeVersion" : "38",
          "sampleType" : "WES",
          "sourceFilePath" : "s3://my_folder/my_vcf.vcf"
        },
    ...
我的目标是在
Kibana
中发出一个查询来修改
variant.\u meta.sourceFilePath
。以下线程:

我提出了一个问题:

PUT /grch38_test__wes__grch38__variants__20210222/_mapping/variant
{
  "properties": {
    "variant": {
      "type": "nested",
      "properties": {
        "_meta": {
          "type": "nested",
          "properties": {
            "type": "text",
            "sourceFilePath": "s3://my_folder/my_vcf.vcf"
          }
        }
      }
    }
  }
}
但这给了我一个错误:

完整错误消息:

{
  "error": {
    "root_cause": [
      {
        "type": "mapper_parsing_exception",
        "reason": "Expected map for property [fields] on field [type] but got a class java.lang.String"
      }
    ],
    "type": "mapper_parsing_exception",
    "reason": "Expected map for property [fields] on field [type] but got a class java.lang.String"
  },
  "status": 400
}
我也尝试过:

PUT /grch38_test__wes__grch38__variants__20210222/_mapping/variant
{
  "properties": {
    "variant": {
      "type": "nested",
      "properties": {
        "_meta": {
          "type": "nested",
          "properties": {
            "sourceFilePath": {
              "type": "text",
              "value":"s3://my_folder/my_vcf.vcf"
            }
          }
        }
      }
    }
  }
}
但它告诉我,
value
不受支持:

{
  "error": {
    "root_cause": [
      {
        "type": "mapper_parsing_exception",
        "reason": "Mapping definition for [sourceFilePath] has unsupported parameters:  [value : s3://seqr-dp-data--prod/vcf/dev/grch38_test_contracted.vcf]"
      }
    ],
    "type": "mapper_parsing_exception",
    "reason": "Mapping definition for [sourceFilePath] has unsupported parameters:  [value : s3://seqr-dp-data--prod/vcf/dev/grch38_test_contracted.vcf]"
  },
  "status": 400
}

我做错了什么?如何修改该字段?

\u meta
是的保留字段。它并不意味着可以搜索,只能通过

这意味着,如果您的
\u meta
内容旨在与
\u meta
字段的设计目的一致,则无法对其应用任何映射。它是具体值的“最终”哈希映射,需要在更新映射负载的顶层定义:

PUT /grch38_test__wes__grch38__variants__20210222/_mapping/variant
{
  "_meta": {
    "variant": {            <-- shared index-level metadata
      "gencodeVersion": "25",
      "hail_version": "0.2.20",
      "genomeVersion": "38",
      "sampleType": "WES",
      "sourceFilePath": "s3://my_folder/my_vcf.vcf"
    }
  },
  "properties": {
    "some_text_field": {    <-- actual document properties
      "type": "text" 
    }
  }
}
并接收以下格式的文件:

POST grch38_test__wes__grch38__variants__20210222/variant/_doc
{
  "_meta": {
    "variant": {
      "gencodeVersion": "25",
      "hail_version": "0.2.20",
      "genomeVersion": "38",
      "sampleType": "WES",
      "sourceFilePath": "s3://my_folder/my_vcf.vcf"
    }
  }
}
但是,元数据是特定于文档的,而不是索引范围

顺便说一句,
nested
映射只有在处理对象而不是对象的对象时才有意义。 但如果你坚持想要它,你会这样做:

PUT /grch38_test__wes__grch38__variants__20210222/_mapping/variant?include_type_name
{
  "properties": {
    "_meta": {
      "type": "nested",            <---
      "properties": {
        "variant": {
          "type": "nested",        <---
          "properties": {
            "gencodeVersion": {
              "type": "text"
            },
            "genomeVersion": {
              "type": "text"
            },
            "hail_version": {
              "type": "text"
            },
            "sampleType": {
              "type": "text"
            },
            "sourceFilePath": {
              "type": "text"
            }
          }
        }
      }
    }
  }
}
PUT/grch38\u test\uuuu wes\uuuuu grch38\uuuu variants\uuuuuuuuuu 20210222/\u映射/variant?包括类型\u名称
{
“财产”:{
“_meta”:{
“type”:“nested”,那么它的意思是什么(第一种情况,
\u meta
对应于它应该是什么)
sourceFilePath
是在创建索引时定义的,它是不允许修改的,没有办法修改吗?不--您可以用我的第一个代码片段修改共享的
\u meta
属性--只需确保删除
属性
部分即可。
PUT /grch38_test__wes__grch38__variants__20210222/_mapping/variant?include_type_name
{
  "properties": {
    "_meta": {
      "type": "nested",            <---
      "properties": {
        "variant": {
          "type": "nested",        <---
          "properties": {
            "gencodeVersion": {
              "type": "text"
            },
            "genomeVersion": {
              "type": "text"
            },
            "hail_version": {
              "type": "text"
            },
            "sampleType": {
              "type": "text"
            },
            "sourceFilePath": {
              "type": "text"
            }
          }
        }
      }
    }
  }
}