以下是一个简单的 Elasticsearch (ES) 中 document 的示例:

{
  'index': 'my_index',
  'id': '1',
  'body': {
    'title': 'Elasticsearch Tutorial',
    'description': 'Learn Elasticsearch from scratch',
    'tags': ['elasticsearch', 'tutorial'],
    'author': {
      'name': 'John Doe',
      'email': 'john.doe@example.com'
    },
    'published_date': '2022-08-01',
    'views': 1000
  }
}

这个 document 属于名为 'my_index' 的索引,有一个唯一的 id 为 '1'。它包含了一些字段,如 'title','description','tags','author' 等等。其中,'tags' 是一个字符串数组,'author' 是一个嵌套的对象。其他字段包括 'published_date' 和 'views',它们分别代表发布日期和浏览量。

在 ES 中,每个 document 都有一个唯一的 id 和一个对应的索引。这个 id 可以是自动生成的,也可以手动指定。document 中的字段可以是任何类型,包括字符串、数字、日期、数组、嵌套的对象等等。


原文地址: https://www.cveoy.top/t/topic/mXtz 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录