如何对Elasticsearch索引映射进行注释?

huangapple go评论52阅读模式
英文:

How to comment on an Elasticsearch index mapping?

问题

There is no direct translation needed for code-related phrases. Here's the translation of the non-code part:

"在我创建一个供更大团队使用的索引时,我需要记录基本信息,如日期、时间、作者、范围等。

除了过于显眼的索引名称之外,是否有可以使用的注释字段?"

英文:

As I create an index used by a larger team, I need to document basics like the date, time, author, scope, etc.

Is there a comment field I can use besides the too-exposed index name?

答案1

得分: 1

你可以使用映射中的 _meta 字段 来添加适合你的索引的自定义信息。

PUT my-index-000001
{
  "_mappings": {
    "_meta": { 
      "date": "2023-05-17",
      "time": "10:12",
      "author": "John Doe",
      "scope": "Development"
    }
  }
}

可以使用更新映射 API 在现有类型上更新 _meta 字段:

PUT my-index-000001/_mapping
{
  "_meta": {
    "date": "2023-05-18",
    "time": "23:10",
    "author": "Jane Doe",
    "scope": "Quality"
  }
}
英文:

You can use the _meta field in the mapping to add any custom information that suits your index.

PUT my-index-000001
{
  "mappings": {
    "_meta": { 
      "date": "2023-05-17",
      "time": "10:12",
      "author": "John Doe",
      "scope": "Development"
    }
  }
}

The _meta field can be updated on an existing type using the update mapping API:

PUT my-index-000001/_mapping
{
  "_meta": {
    "date": "2023-05-18",
    "time": "23:10",
    "author": "Jane Doe",
    "scope": "Quality"
  }
}

huangapple
  • 本文由 发表于 2023年5月17日 16:10:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/76269870.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定