Spec-Zone.ru › Elasticsearch 7
›Elasticsearch Guide [7.17] ›Mapping ›Поля метаданных

Поле _type

Устарело в 6.0.0.

См. Удаление типов отображения

Каждый индексированный документ связан с полем _type и полем _id. Поле _type индексируется для ускорения поиска по имени типа.

Значение поля _type доступно в запросах, агрегациях, скриптах и при сортировке:

# Example documents

PUT my-index-000001/_doc/1?refresh=true
{
  "text": "Document with type 'doc'"
}

GET my-index-000001/_search
{
  "query": {
    "term": {
      "_type": "_doc"  
    }
  },
  "aggs": {
    "types": {
      "terms": {
        "field": "_type", 
        "size": 10
      }
    }
  },
  "sort": [
    {
      "_type": { 
        "order": "desc"
      }
    }
  ],
  "script_fields": {
    "type": {
      "script": {
        "lang": "painless",
        "source": "doc['_type']" 
      }
    }
  }
}

Запрос к полю _type

Агрегация по полю _type

Сортировка по полю _type

Доступ к полю _type в скриптах

© 2023-2025 Elasticsearch
As of September 2024, Elasticsearch is available under a choice of three licenses: the Server Side Public License (SSPL), the Elastic License, or the AGPLv3 (OSI approved).
Elasticsearch and the Elasticsearch logo are trademarks of Elasticsearch B.V., registered in the U.S. and in other countries.
https://www.elastic.co/guide/en/elasticsearch/reference/7.17/mapping-type-field.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API