Spec-Zone.ru › Elasticsearch 8
›Elasticsearch Guide [8.17] ›Mapping ›Типы данных полей

Тип поля rank feature

Поле типа rank_feature может индексировать числа, чтобы их можно было использовать для повышения документов в запросах с помощью запроса rank_feature.

resp = client.indices.create(
    index="my-index-000001",
    mappings={
        "properties": {
            "pagerank": {
                "type": "rank_feature"
            },
            "url_length": {
                "type": "rank_feature",
                "positive_score_impact": False
            }
        }
    },
)
print(resp)

resp1 = client.index(
    index="my-index-000001",
    id="1",
    document={
        "pagerank": 8,
        "url_length": 22
    },
)
print(resp1)

resp2 = client.search(
    index="my-index-000001",
    query={
        "rank_feature": {
            "field": "pagerank"
        }
    },
)
print(resp2)
response = client.indices.create(
  index: 'my-index-000001',
  body: {
    mappings: {
      properties: {
        pagerank: {
          type: 'rank_feature'
        },
        url_length: {
          type: 'rank_feature',
          positive_score_impact: false
        }
      }
    }
  }
)
puts response

response = client.index(
  index: 'my-index-000001',
  id: 1,
  body: {
    pagerank: 8,
    url_length: 22
  }
)
puts response

response = client.search(
  index: 'my-index-000001',
  body: {
    query: {
      rank_feature: {
        field: 'pagerank'
      }
    }
  }
)
puts response
const response = await client.indices.create({
  index: "my-index-000001",
  mappings: {
    properties: {
      pagerank: {
        type: "rank_feature",
      },
      url_length: {
        type: "rank_feature",
        positive_score_impact: false,
      },
    },
  },
});
console.log(response);

const response1 = await client.index({
  index: "my-index-000001",
  id: 1,
  document: {
    pagerank: 8,
    url_length: 22,
  },
});
console.log(response1);

const response2 = await client.search({
  index: "my-index-000001",
  query: {
    rank_feature: {
      field: "pagerank",
    },
  },
});
console.log(response2);
PUT my-index-000001
{
  "mappings": {
    "properties": {
      "pagerank": {
        "type": "rank_feature" 
      },
      "url_length": {
        "type": "rank_feature",
        "positive_score_impact": false 
      }
    }
  }
}

PUT my-index-000001/_doc/1
{
  "pagerank": 8,
  "url_length": 22
}

GET my-index-000001/_search
{
  "query": {
    "rank_feature": {
      "field": "pagerank"
    }
  }
}

Поля типа rank feature должны использовать тип поля rank_feature

Функции ранжирования, которые коррелируют с рейтингом отрицательно, необходимо объявить об этом

Поля типа rank_feature поддерживают только поля с одним значением и строго положительными значениями. Поля с несколькими значениями и отрицательными значениями будут отклонены.

Поля типа rank_feature не поддерживают запросы, сортировку или агрегацию. Они могут использоваться только в запросах rank_feature.

Поля типа rank_feature сохраняют только 9 значащих битов для точности, что соответствует относительной ошибке около 0,4%.

Функции ранжирования, которые коррелируют отрицательно с оценкой, должны установить positive_score_impact на false (по умолчанию true). Это будет использоваться запросом rank_feature для изменения формулы оценки таким образом, что оценка уменьшается со значением функции, а не увеличивается. Например, в веб-поиске длина URL-адреса — это часто используемая функция, которая коррелирует отрицательно с оценками.

© 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/8.17/rank-feature.html

Spec-Zone.ru

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