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

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

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 字段 来添加适合你的索引的自定义信息。

  1. PUT my-index-000001
  2. {
  3. "_mappings": {
  4. "_meta": {
  5. "date": "2023-05-17",
  6. "time": "10:12",
  7. "author": "John Doe",
  8. "scope": "Development"
  9. }
  10. }
  11. }

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

  1. PUT my-index-000001/_mapping
  2. {
  3. "_meta": {
  4. "date": "2023-05-18",
  5. "time": "23:10",
  6. "author": "Jane Doe",
  7. "scope": "Quality"
  8. }
  9. }
英文:

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

  1. PUT my-index-000001
  2. {
  3. "mappings": {
  4. "_meta": {
  5. "date": "2023-05-17",
  6. "time": "10:12",
  7. "author": "John Doe",
  8. "scope": "Development"
  9. }
  10. }
  11. }

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

  1. PUT my-index-000001/_mapping
  2. {
  3. "_meta": {
  4. "date": "2023-05-18",
  5. "time": "23:10",
  6. "author": "Jane Doe",
  7. "scope": "Quality"
  8. }
  9. }

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:

确定