Las traducciones son generadas a través de traducción automática. En caso de conflicto entre la traducción y la version original de inglés, prevalecerá la version en inglés.
Aprender a clasificar para Amazon OpenSearch Service
OpenSearch utiliza un marco de clasificación probabilístico llamado BM-25 para calcular las puntuaciones de relevancia. Si una palabra clave distintiva aparece con más frecuencia en un documento, BM-25 asigna una puntuación de relevancia más alta a ese documento. Este marco, sin embargo, no tiene en cuenta el comportamiento del usuario, como los datos de clics, lo que puede mejorar aún más la relevancia.
Learning to Rank es un complemento de código abierto que permite utilizar machine learning y los datos de comportamiento para ajustar la relevancia de los documentos. El complemento utiliza modelos de las bibliotecas XGBoost y Ranklib para volver a puntuar los resultados de búsqueda. El complemento de Elasticsearch LTR
Aprender a clasificar requiere OpenSearch o Elasticsearch 7.7 o posterior. Para utilizar el complemento Aprender a clasificar, debe tener permisos de administrador completos. Para obtener más información, consulte Modificar el usuario maestro.
nota
Esta documentación proporciona información general del complemento Aprender a clasificar y le ayuda a empezar a usarlo. La documentación completa, incluidos los pasos detallados y las descripciones de la API, está disponible en la documentación de Learning to Rank (Aprender a clasificar)
Introducción a Aprender a clasificar
Debe proporcionar una lista de criterios, preparar un conjunto de datos de entrenamiento y entrenar el modelo fuera de Amazon OpenSearch Service. Las partes en azul se producen fuera de OpenSearch Service:
Paso 1: inicializar el complemento
Para inicializar el complemento Aprender a clasificar, envíe la siguiente solicitud a su dominio de OpenSearch Service:
PUT _ltr
{ "acknowledged" : true, "shards_acknowledged" : true, "index" : ".ltrstore" }
Este comando crea un índice .ltrstore
oculto que almacena información de metadatos, como conjuntos de características y modelos.
Paso 2: crear una lista de criterios
nota
Debe realizar este paso fuera de OpenSearch Service.
Una lista de criterios es un conjunto de ejemplos de los cuales aprende un modelo de machine learning. La lista de criterios debe incluir palabras clave importantes para usted y un conjunto de documentos calificados para cada palabra clave.
En este ejemplo, tenemos una lista de criterios para un conjunto de datos de películas. Un grado de 4 indica una coincidencia perfecta. Un grado de 0 indica la peor coincidencia.
Grado | Palabra clave | ID del documento | Nombre de la película |
---|---|---|---|
4 | rambo | 7555 | Rambo |
3 | rambo | 1370 | Rambo III |
3 | rambo | 1369 | Rambo: First Blood Part II |
3 | rambo | 1368 | First Blood |
Prepare la lista de criterios con el siguiente formato:
4 qid:1 # 7555 Rambo 3 qid:1 # 1370 Rambo III 3 qid:1 # 1369 Rambo: First Blood Part II 3 qid:1 # 1368 First Blood where qid:1 represents "rambo"
Para ver un ejemplo más completo de una lista de criterios, consulte Criterios sobre películas
Puede crear esta lista de criterios de forma manual con la ayuda de anotadores humanos o inferirla de manera programática a partir de datos de análisis.
Paso 3: crear un conjunto de características
Una característica es un campo que corresponde a la relevancia de un documento, por ejemplo, title
, overview
, popularity score
(número de vistas) y así sucesivamente.
Cree un conjunto de características con una plantilla de Mustache para cada característica. Para obtener más información acerca de las características, consulte Trabajo con características
En este ejemplo, crearemos un conjunto de características movie_features
con los campos title
y overview
:
POST _ltr/_featureset/movie_features { "featureset" : { "name" : "movie_features", "features" : [ { "name" : "1", "params" : [ "keywords" ], "template_language" : "mustache", "template" : { "match" : { "title" : "{{keywords}}" } } }, { "name" : "2", "params" : [ "keywords" ], "template_language" : "mustache", "template" : { "match" : { "overview" : "{{keywords}}" } } } ] } }
Si consulta el índice .ltrstore
original, recupera el conjunto de características:
GET _ltr/_featureset
Paso 4: registrar los valores de la característica
Los valores de la característica son las puntuaciones de relevancia calculadas por BM-25 para cada característica.
Combine el conjunto de características y la lista de sentencias para registrar los valores de la característica. Para obtener más información acerca de las características de registro, consulte Puntuaciones de características
En este ejemplo, la consulta bool
recupera los documentos calificados con el filtro y, a continuación, elige el conjunto de características con la consulta sltr
. La consulta ltr_log
combina los documentos y las características para registrar los valores de característica correspondientes:
POST tmdb/_search { "_source": { "includes": [ "title", "overview" ] }, "query": { "bool": { "filter": [ { "terms": { "_id": [ "7555", "1370", "1369", "1368" ] } }, { "sltr": { "_name": "logged_featureset", "featureset": "movie_features", "params": { "keywords": "rambo" } } } ] } }, "ext": { "ltr_log": { "log_specs": { "name": "log_entry1", "named_query": "logged_featureset" } } } }
Un ejemplo de respuesta se vería así:
{ "took" : 7, "timed_out" : false, "_shards" : { "total" : 1, "successful" : 1, "skipped" : 0, "failed" : 0 }, "hits" : { "total" : { "value" : 4, "relation" : "eq" }, "max_score" : 0.0, "hits" : [ { "_index" : "tmdb", "_type" : "movie", "_id" : "1368", "_score" : 0.0, "_source" : { "overview" : "When former Green Beret John Rambo is harassed by local law enforcement and arrested for vagrancy, the Vietnam vet snaps, runs for the hills and rat-a-tat-tats his way into the action-movie hall of fame. Hounded by a relentless sheriff, Rambo employs heavy-handed guerilla tactics to shake the cops off his tail.", "title" : "First Blood" }, "fields" : { "_ltrlog" : [ { "log_entry1" : [ { "name" : "1" }, { "name" : "2", "value" : 10.558305 } ] } ] }, "matched_queries" : [ "logged_featureset" ] }, { "_index" : "tmdb", "_type" : "movie", "_id" : "7555", "_score" : 0.0, "_source" : { "overview" : "When governments fail to act on behalf of captive missionaries, ex-Green Beret John James Rambo sets aside his peaceful existence along the Salween River in a war-torn region of Thailand to take action. Although he's still haunted by violent memories of his time as a U.S. soldier during the Vietnam War, Rambo can hardly turn his back on the aid workers who so desperately need his help.", "title" : "Rambo" }, "fields" : { "_ltrlog" : [ { "log_entry1" : [ { "name" : "1", "value" : 11.2569065 }, { "name" : "2", "value" : 9.936821 } ] } ] }, "matched_queries" : [ "logged_featureset" ] }, { "_index" : "tmdb", "_type" : "movie", "_id" : "1369", "_score" : 0.0, "_source" : { "overview" : "Col. Troutman recruits ex-Green Beret John Rambo for a highly secret and dangerous mission. Teamed with Co Bao, Rambo goes deep into Vietnam to rescue POWs. Deserted by his own team, he's left in a hostile jungle to fight for his life, avenge the death of a woman and bring corrupt officials to justice.", "title" : "Rambo: First Blood Part II" }, "fields" : { "_ltrlog" : [ { "log_entry1" : [ { "name" : "1", "value" : 6.334839 }, { "name" : "2", "value" : 10.558305 } ] } ] }, "matched_queries" : [ "logged_featureset" ] }, { "_index" : "tmdb", "_type" : "movie", "_id" : "1370", "_score" : 0.0, "_source" : { "overview" : "Combat has taken its toll on Rambo, but he's finally begun to find inner peace in a monastery. When Rambo's friend and mentor Col. Trautman asks for his help on a top secret mission to Afghanistan, Rambo declines but must reconsider when Trautman is captured.", "title" : "Rambo III" }, "fields" : { "_ltrlog" : [ { "log_entry1" : [ { "name" : "1", "value" : 9.425955 }, { "name" : "2", "value" : 11.262714 } ] } ] }, "matched_queries" : [ "logged_featureset" ] } ] } }
En el ejemplo anterior, la primera característica no posee un valor de característica, ya que la palabra clave “rambo” no aparece en el campo de título del documento con un ID igual a 1368. Se trata de un valor de característica que falta en los datos de entrenamiento.
Paso 5: crear un conjunto de datos de entrenamiento
nota
Debe realizar este paso fuera de OpenSearch Service.
El siguiente paso es combinar la lista de sentencias y los valores de característica para crear un conjunto de datos de entrenamiento. Si la lista de criterios original se ve así:
4 qid:1 # 7555 Rambo 3 qid:1 # 1370 Rambo III 3 qid:1 # 1369 Rambo: First Blood Part II 3 qid:1 # 1368 First Blood
Conviértala en el conjunto de datos de entrenamiento final, que se ve así:
4 qid:1 1:12.318474 2:10.573917 # 7555 rambo 3 qid:1 1:10.357875 2:11.950391 # 1370 rambo 3 qid:1 1:7.010513 2:11.220095 # 1369 rambo 3 qid:1 1:0.0 2:11.220095 # 1368 rambo
Puede realizar este paso de forma manual o escribir un programa para automatizarlo.
Paso 6: elegir un algoritmo y crear el modelo
nota
Debe realizar este paso fuera de OpenSearch Service.
Con el conjunto de datos de entrenamiento en su lugar, el siguiente paso es utilizar las bibliotecas XGBoost o Ranklib para crear un modelo. Las bibliotecas XGBoost y Ranklib permiten crear modelos populares como LambdaMART, Random Forests, etc.
Para conocer los pasos para utilizar XGBoost y Ranklib para crear el modelo, consulte la documentación sobre XGBoost
Paso 7: implementar el modelo
Después de haber creado el modelo, impleméntelo en el complemento Learning to Rank (Aprender a clasificar). Para obtener más información acerca de la implementación de un modelo, consulte Carga de un modelo entrenado
En este ejemplo, crearemos un modelo de my_ranklib_model
con la biblioteca Ranklib:
POST _ltr/_featureset/movie_features/_createmodel?pretty { "model": { "name": "my_ranklib_model", "model": { "type": "model/ranklib", "definition": """## LambdaMART ## No. of trees = 10 ## No. of leaves = 10 ## No. of threshold candidates = 256 ## Learning rate = 0.1 ## Stop early = 100 <ensemble> <tree id="1" weight="0.1"> <split> <feature>1</feature> <threshold>10.357875</threshold> <split pos="left"> <feature>1</feature> <threshold>0.0</threshold> <split pos="left"> <output>-2.0</output> </split> <split pos="right"> <feature>1</feature> <threshold>7.010513</threshold> <split pos="left"> <output>-2.0</output> </split> <split pos="right"> <output>-2.0</output> </split> </split> </split> <split pos="right"> <output>2.0</output> </split> </split> </tree> <tree id="2" weight="0.1"> <split> <feature>1</feature> <threshold>10.357875</threshold> <split pos="left"> <feature>1</feature> <threshold>0.0</threshold> <split pos="left"> <output>-1.67031991481781</output> </split> <split pos="right"> <feature>1</feature> <threshold>7.010513</threshold> <split pos="left"> <output>-1.67031991481781</output> </split> <split pos="right"> <output>-1.6703200340270996</output> </split> </split> </split> <split pos="right"> <output>1.6703201532363892</output> </split> </split> </tree> <tree id="3" weight="0.1"> <split> <feature>2</feature> <threshold>10.573917</threshold> <split pos="left"> <output>1.479954481124878</output> </split> <split pos="right"> <feature>1</feature> <threshold>7.010513</threshold> <split pos="left"> <feature>1</feature> <threshold>0.0</threshold> <split pos="left"> <output>-1.4799546003341675</output> </split> <split pos="right"> <output>-1.479954481124878</output> </split> </split> <split pos="right"> <output>-1.479954481124878</output> </split> </split> </split> </tree> <tree id="4" weight="0.1"> <split> <feature>1</feature> <threshold>10.357875</threshold> <split pos="left"> <feature>1</feature> <threshold>0.0</threshold> <split pos="left"> <output>-1.3569872379302979</output> </split> <split pos="right"> <feature>1</feature> <threshold>7.010513</threshold> <split pos="left"> <output>-1.3569872379302979</output> </split> <split pos="right"> <output>-1.3569872379302979</output> </split> </split> </split> <split pos="right"> <output>1.3569873571395874</output> </split> </split> </tree> <tree id="5" weight="0.1"> <split> <feature>1</feature> <threshold>10.357875</threshold> <split pos="left"> <feature>1</feature> <threshold>0.0</threshold> <split pos="left"> <output>-1.2721362113952637</output> </split> <split pos="right"> <feature>1</feature> <threshold>7.010513</threshold> <split pos="left"> <output>-1.2721363306045532</output> </split> <split pos="right"> <output>-1.2721363306045532</output> </split> </split> </split> <split pos="right"> <output>1.2721362113952637</output> </split> </split> </tree> <tree id="6" weight="0.1"> <split> <feature>1</feature> <threshold>10.357875</threshold> <split pos="left"> <feature>1</feature> <threshold>7.010513</threshold> <split pos="left"> <feature>1</feature> <threshold>0.0</threshold> <split pos="left"> <output>-1.2110036611557007</output> </split> <split pos="right"> <output>-1.2110036611557007</output> </split> </split> <split pos="right"> <output>-1.2110037803649902</output> </split> </split> <split pos="right"> <output>1.2110037803649902</output> </split> </split> </tree> <tree id="7" weight="0.1"> <split> <feature>1</feature> <threshold>10.357875</threshold> <split pos="left"> <feature>1</feature> <threshold>7.010513</threshold> <split pos="left"> <feature>1</feature> <threshold>0.0</threshold> <split pos="left"> <output>-1.165616512298584</output> </split> <split pos="right"> <output>-1.165616512298584</output> </split> </split> <split pos="right"> <output>-1.165616512298584</output> </split> </split> <split pos="right"> <output>1.165616512298584</output> </split> </split> </tree> <tree id="8" weight="0.1"> <split> <feature>1</feature> <threshold>10.357875</threshold> <split pos="left"> <feature>1</feature> <threshold>7.010513</threshold> <split pos="left"> <feature>1</feature> <threshold>0.0</threshold> <split pos="left"> <output>-1.131177544593811</output> </split> <split pos="right"> <output>-1.131177544593811</output> </split> </split> <split pos="right"> <output>-1.131177544593811</output> </split> </split> <split pos="right"> <output>1.131177544593811</output> </split> </split> </tree> <tree id="9" weight="0.1"> <split> <feature>2</feature> <threshold>10.573917</threshold> <split pos="left"> <output>1.1046180725097656</output> </split> <split pos="right"> <feature>1</feature> <threshold>7.010513</threshold> <split pos="left"> <feature>1</feature> <threshold>0.0</threshold> <split pos="left"> <output>-1.1046180725097656</output> </split> <split pos="right"> <output>-1.1046180725097656</output> </split> </split> <split pos="right"> <output>-1.1046180725097656</output> </split> </split> </split> </tree> <tree id="10" weight="0.1"> <split> <feature>1</feature> <threshold>10.357875</threshold> <split pos="left"> <feature>1</feature> <threshold>7.010513</threshold> <split pos="left"> <feature>1</feature> <threshold>0.0</threshold> <split pos="left"> <output>-1.0838804244995117</output> </split> <split pos="right"> <output>-1.0838804244995117</output> </split> </split> <split pos="right"> <output>-1.0838804244995117</output> </split> </split> <split pos="right"> <output>1.0838804244995117</output> </split> </split> </tree> </ensemble> """ } } }
Para ver el modelo, envíe la siguiente solicitud:
GET _ltr/_model/my_ranklib_model
Paso 8: buscar con Aprender a clasificar
Después de implementar el modelo, estará listo para realizar la búsqueda.
Realice la consulta sltr
con las características que utiliza y el nombre del modelo que desea ejecutar:
POST tmdb/_search { "_source": { "includes": ["title", "overview"] }, "query": { "multi_match": { "query": "rambo", "fields": ["title", "overview"] } }, "rescore": { "query": { "rescore_query": { "sltr": { "params": { "keywords": "rambo" }, "model": "my_ranklib_model" } } } } }
Con Aprender a clasificar, usted ve “Rambo” como el primer resultado porque le asignamos la calificación más alta en la lista de criterios:
{ "took" : 12, "timed_out" : false, "_shards" : { "total" : 1, "successful" : 1, "skipped" : 0, "failed" : 0 }, "hits" : { "total" : { "value" : 7, "relation" : "eq" }, "max_score" : 13.096414, "hits" : [ { "_index" : "tmdb", "_type" : "movie", "_id" : "7555", "_score" : 13.096414, "_source" : { "overview" : "When governments fail to act on behalf of captive missionaries, ex-Green Beret John James Rambo sets aside his peaceful existence along the Salween River in a war-torn region of Thailand to take action. Although he's still haunted by violent memories of his time as a U.S. soldier during the Vietnam War, Rambo can hardly turn his back on the aid workers who so desperately need his help.", "title" : "Rambo" } }, { "_index" : "tmdb", "_type" : "movie", "_id" : "1370", "_score" : 11.17245, "_source" : { "overview" : "Combat has taken its toll on Rambo, but he's finally begun to find inner peace in a monastery. When Rambo's friend and mentor Col. Trautman asks for his help on a top secret mission to Afghanistan, Rambo declines but must reconsider when Trautman is captured.", "title" : "Rambo III" } }, { "_index" : "tmdb", "_type" : "movie", "_id" : "1368", "_score" : 10.442155, "_source" : { "overview" : "When former Green Beret John Rambo is harassed by local law enforcement and arrested for vagrancy, the Vietnam vet snaps, runs for the hills and rat-a-tat-tats his way into the action-movie hall of fame. Hounded by a relentless sheriff, Rambo employs heavy-handed guerilla tactics to shake the cops off his tail.", "title" : "First Blood" } }, { "_index" : "tmdb", "_type" : "movie", "_id" : "1369", "_score" : 10.442155, "_source" : { "overview" : "Col. Troutman recruits ex-Green Beret John Rambo for a highly secret and dangerous mission. Teamed with Co Bao, Rambo goes deep into Vietnam to rescue POWs. Deserted by his own team, he's left in a hostile jungle to fight for his life, avenge the death of a woman and bring corrupt officials to justice.", "title" : "Rambo: First Blood Part II" } }, { "_index" : "tmdb", "_type" : "movie", "_id" : "31362", "_score" : 7.424202, "_source" : { "overview" : "It is 1985, and a small, tranquil Florida town is being rocked by a wave of vicious serial murders and bank robberies. Particularly sickening to the authorities is the gratuitous use of violence by two “Rambo” like killers who dress themselves in military garb. Based on actual events taken from FBI files, the movie depicts the Bureau’s efforts to track down these renegades.", "title" : "In the Line of Duty: The F.B.I. Murders" } }, { "_index" : "tmdb", "_type" : "movie", "_id" : "13258", "_score" : 6.43182, "_source" : { "overview" : """Will Proudfoot (Bill Milner) is looking for an escape from his family's stifling home life when he encounters Lee Carter (Will Poulter), the school bully. Armed with a video camera and a copy of "Rambo: First Blood", Lee plans to make cinematic history by filming his own action-packed video epic. Together, these two newfound friends-turned-budding-filmmakers quickly discover that their imaginative ― and sometimes mishap-filled ― cinematic adventure has begun to take on a life of its own!""", "title" : "Son of Rambow" } }, { "_index" : "tmdb", "_type" : "movie", "_id" : "61410", "_score" : 3.9719706, "_source" : { "overview" : "It's South Africa 1990. Two major events are about to happen: The release of Nelson Mandela and, more importantly, it's Spud Milton's first year at an elite boys only private boarding school. John Milton is a boy from an ordinary background who wins a scholarship to a private school in Kwazulu-Natal, South Africa. Surrounded by boys with nicknames like Gecko, Rambo, Rain Man and Mad Dog, Spud has his hands full trying to adapt to his new home. Along the way Spud takes his first tentative steps along the path to manhood. (The path it seems could be a rather long road). Spud is an only child. He is cursed with parents from well beyond the lunatic fringe and a senile granny. His dad is a fervent anti-communist who is paranoid that the family domestic worker is running a shebeen from her room at the back of the family home. His mom is a free spirit and a teenager's worst nightmare, whether it's shopping for Spud's underwear in the local supermarket", "title" : "Spud" } } ] } }
Si realiza la búsqueda sin utilizar el complemento Aprender a clasificar, OpenSearch devuelve resultados diferentes:
POST tmdb/_search { "_source": { "includes": ["title", "overview"] }, "query": { "multi_match": { "query": "Rambo", "fields": ["title", "overview"] } } }
{ "took" : 5, "timed_out" : false, "_shards" : { "total" : 1, "successful" : 1, "skipped" : 0, "failed" : 0 }, "hits" : { "total" : { "value" : 5, "relation" : "eq" }, "max_score" : 11.262714, "hits" : [ { "_index" : "tmdb", "_type" : "movie", "_id" : "1370", "_score" : 11.262714, "_source" : { "overview" : "Combat has taken its toll on Rambo, but he's finally begun to find inner peace in a monastery. When Rambo's friend and mentor Col. Trautman asks for his help on a top secret mission to Afghanistan, Rambo declines but must reconsider when Trautman is captured.", "title" : "Rambo III" } }, { "_index" : "tmdb", "_type" : "movie", "_id" : "7555", "_score" : 11.2569065, "_source" : { "overview" : "When governments fail to act on behalf of captive missionaries, ex-Green Beret John James Rambo sets aside his peaceful existence along the Salween River in a war-torn region of Thailand to take action. Although he's still haunted by violent memories of his time as a U.S. soldier during the Vietnam War, Rambo can hardly turn his back on the aid workers who so desperately need his help.", "title" : "Rambo" } }, { "_index" : "tmdb", "_type" : "movie", "_id" : "1368", "_score" : 10.558305, "_source" : { "overview" : "When former Green Beret John Rambo is harassed by local law enforcement and arrested for vagrancy, the Vietnam vet snaps, runs for the hills and rat-a-tat-tats his way into the action-movie hall of fame. Hounded by a relentless sheriff, Rambo employs heavy-handed guerilla tactics to shake the cops off his tail.", "title" : "First Blood" } }, { "_index" : "tmdb", "_type" : "movie", "_id" : "1369", "_score" : 10.558305, "_source" : { "overview" : "Col. Troutman recruits ex-Green Beret John Rambo for a highly secret and dangerous mission. Teamed with Co Bao, Rambo goes deep into Vietnam to rescue POWs. Deserted by his own team, he's left in a hostile jungle to fight for his life, avenge the death of a woman and bring corrupt officials to justice.", "title" : "Rambo: First Blood Part II" } }, { "_index" : "tmdb", "_type" : "movie", "_id" : "13258", "_score" : 6.4600153, "_source" : { "overview" : """Will Proudfoot (Bill Milner) is looking for an escape from his family's stifling home life when he encounters Lee Carter (Will Poulter), the school bully. Armed with a video camera and a copy of "Rambo: First Blood", Lee plans to make cinematic history by filming his own action-packed video epic. Together, these two newfound friends-turned-budding-filmmakers quickly discover that their imaginative ― and sometimes mishap-filled ― cinematic adventure has begun to take on a life of its own!""", "title" : "Son of Rambow" } } ] } }
En función de cuán bien considere que el modelo funciona, ajuste la lista de criterios y las características. A continuación, repita los pasos 2 a 8 para mejorar los resultados de la clasificación a lo largo del tiempo.
API de Aprender a clasificar
Utilice las operaciones de Aprender a clasificar para trabajar de manera programática con conjuntos de características y modelos.
Crear tienda
Crea un índice .ltrstore
oculto que almacena información sobre metadatos, como conjuntos de características y modelos.
PUT _ltr
Eliminar tienda
Elimina el índice .ltrstore
oculto y restablece el complemento.
DELETE _ltr
Crear conjunto de características
Crea un conjunto de características.
POST _ltr/_featureset/<name_of_features>
Eliminar un conjunto de características
Elimina un conjunto de características.
DELETE _ltr/_featureset/<name_of_feature_set>
Obtener un conjunto de características
Recupera un conjunto de características.
GET _ltr/_featureset/<name_of_feature_set>
Crear un modelo
Crea un modelo.
POST _ltr/_featureset/<name_of_feature_set>/_createmodel
Eliminar modelo
Elimina un modelo.
DELETE _ltr/_model/<name_of_model>
Obtener modelo
Recupera un modelo.
GET _ltr/_model/<name_of_model>
Obtener estadísticas
Proporciona información acerca de cómo se comporta el complemento.
GET _ltr/_stats
También puede usar filtros para recuperar una sola estadística:
GET _ltr/_stats/<stat>
Además, puede limitar la información a un único nodo en el clúster:
GET _ltr/_stats/<stat>/nodes/<nodeId> { "_nodes" : { "total" : 1, "successful" : 1, "failed" : 0 }, "cluster_name" : "873043598401:ltr-77", "stores" : { ".ltrstore" : { "model_count" : 1, "featureset_count" : 1, "feature_count" : 2, "status" : "green" } }, "status" : "green", "nodes" : { "DjelK-_ZSfyzstO5dhGGQA" : { "cache" : { "feature" : { "eviction_count" : 0, "miss_count" : 0, "entry_count" : 0, "memory_usage_in_bytes" : 0, "hit_count" : 0 }, "featureset" : { "eviction_count" : 2, "miss_count" : 2, "entry_count" : 0, "memory_usage_in_bytes" : 0, "hit_count" : 0 }, "model" : { "eviction_count" : 2, "miss_count" : 3, "entry_count" : 1, "memory_usage_in_bytes" : 3204, "hit_count" : 1 } }, "request_total_count" : 6, "request_error_count" : 0 } } }
Las estadísticas se proporcionan en dos niveles, nodo y clúster, como se especifica en las siguientes tablas:
Nombre del campo | Descripción |
---|---|
request_total_count | Recuento total de solicitudes de clasificación. |
request_error_count | Recuento total de solicitudes fallidas. |
cache | Estadísticas de todas las cachés (características, conjuntos de características, modelos). Se produce un acierto de caché cuando un usuario consulta el complemento y el modelo ya está cargado en la memoria. |
cache.eviction_count | Número de expulsiones de caché. |
cache.hit_count | Número de aciertos de caché. |
cache.miss_count | Número de errores de caché. Se produce un error de caché cuando un usuario consulta el complemento y el modelo aún no se cargó en la memoria. |
cache.entry_count | Número de entradas en la caché. |
cache.memory_usage_in_bytes | Memoria total utilizada en bytes. |
cache.cache_capacity_reached | Indica si se alcanza el límite de caché. |
Nombre del campo | Descripción |
---|---|
tiendas | Indica dónde se almacenan los conjuntos de características y los metadatos del modelo. (El valor predeterminado es “.ltrstore”. De lo contrario, tiene el prefijo “.ltrstore_”, con un nombre proporcionado por el usuario). |
stores.status | Estado del índice. |
stores.feature_sets | Número de conjuntos de características. |
stores.features_count | Número de características. |
stores.model_count | Número de modelos. |
estado | Estado del complemento basado en el estado de los índices del almacén de características (rojo, amarillo o verde) y el estado del interruptor de circuito (abierto o cerrado). |
cache.cache_capacity_reached | Indica si se alcanza el límite de caché. |
Obtener estadísticas de caché
Devuelve estadísticas sobre el uso de la memoria y la caché.
GET _ltr/_cachestats { "_nodes": { "total": 2, "successful": 2, "failed": 0 }, "cluster_name": "opensearch-cluster", "all": { "total": { "ram": 612, "count": 1 }, "features": { "ram": 0, "count": 0 }, "featuresets": { "ram": 612, "count": 1 }, "models": { "ram": 0, "count": 0 } }, "stores": { ".ltrstore": { "total": { "ram": 612, "count": 1 }, "features": { "ram": 0, "count": 0 }, "featuresets": { "ram": 612, "count": 1 }, "models": { "ram": 0, "count": 0 } } }, "nodes": { "ejF6uutERF20wOFNOXB61A": { "name": "opensearch1", "hostname": "172.18.0.4", "stats": { "total": { "ram": 612, "count": 1 }, "features": { "ram": 0, "count": 0 }, "featuresets": { "ram": 612, "count": 1 }, "models": { "ram": 0, "count": 0 } } }, "Z2RZNWRLSveVcz2c6lHf5A": { "name": "opensearch2", "hostname": "172.18.0.2", "stats": { ... } } } }
Borrar caché
Borra la caché del complemento. Utilice esta opción para actualizar el modelo.
POST _ltr/_clearcache