Процессор Fingerprint
Вычисляет хэш содержимого документа. Вы можете использовать этот хэш для отпечатков содержимого.
Таблица 19. Параметры Fingerprint
| Имя | Требуется | По умолчанию | Описание |
|---|---|---|---|
| да | n/a | Массив полей, которые нужно включить в отпечаток. Для объектов процессор хеширует и ключ, и значение поля. Для других полей процессор хеширует только значение поля. |
| нет |
| Поле вывода для отпечатка. |
| нет | <none> | Значение соли для хеш-функции. |
| нет |
| Метод хеширования, используемый для вычисления отпечатка. Должен быть одним из |
| нет |
| Если |
| нет | - | Описание процессора. Полезно для описания цели процессора или его конфигурации. |
| нет | - | Условное выполнение процессора. См. Условное выполнение процессора. |
| нет |
| Игнорировать ошибки для процессора. См. Обработка ошибок конвейера. |
| нет | - | Обрабатывать ошибки для процессора. См. Обработка ошибок конвейера. |
| нет | - | Идентификатор процессора. Полезно для отладки и метрик. |
Пример
Следующий пример демонстрирует использование процессора fingerprint:
resp = client.ingest.simulate(
pipeline={
"processors": [
{
"fingerprint": {
"fields": [
"user"
]
}
}
]
},
docs=[
{
"_source": {
"user": {
"last_name": "Smith",
"first_name": "John",
"date_of_birth": "1980-01-15",
"is_active": True
}
}
}
],
)
print(resp) response = client.ingest.simulate(
body: {
pipeline: {
processors: [
{
fingerprint: {
fields: [
'user'
]
}
}
]
},
docs: [
{
_source: {
user: {
last_name: 'Smith',
first_name: 'John',
date_of_birth: '1980-01-15',
is_active: true
}
}
}
]
}
)
puts response const response = await client.ingest.simulate({
pipeline: {
processors: [
{
fingerprint: {
fields: ["user"],
},
},
],
},
docs: [
{
_source: {
user: {
last_name: "Smith",
first_name: "John",
date_of_birth: "1980-01-15",
is_active: true,
},
},
},
],
});
console.log(response); POST _ingest/pipeline/_simulate
{
"pipeline": {
"processors": [
{
"fingerprint": {
"fields": ["user"]
}
}
]
},
"docs": [
{
"_source": {
"user": {
"last_name": "Smith",
"first_name": "John",
"date_of_birth": "1980-01-15",
"is_active": true
}
}
}
]
} Что даёт следующий результат:
{
"docs": [
{
"doc": {
...
"_source": {
"fingerprint" : "WbSUPW4zY1PBPehh2AA/sSxiRjw=",
"user" : {
"last_name" : "Smith",
"first_name" : "John",
"date_of_birth" : "1980-01-15",
"is_active" : true
}
}
}
}
]
}
© 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/fingerprint-processor.html