Amazon OpenSearch Service 用の Learning to Rank - Amazon OpenSearch サービス

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

Amazon OpenSearch Service 用の Learning to Rank

OpenSearch は、BM-25 と呼ばれる確率的ランキングフレームワークを使用して、関連性スコアを計算します。特定のキーワードがドキュメント内で頻繁に表示される場合、BM-25 はそのドキュメントに対して高い関連性スコアを割り当てます。ただし、このフレームワークでは、クリックスルーデータなどのユーザーの行動は考慮されないため、関連性がさらに改善します。

Learning to Rank はオープンソースの OpenSearch プラグインで、機械学習と行動データを使用してドキュメントの関連性を調整できます。XGBoost および Ranklib ライブラリのモデルを使用して、検索結果のリスコアを行います。Elasticsearch LTプラグインは当初、OpenSource Connections によって開発され、ウィキメディア財団、Snagajob Engineering、Bonsai、Yelp Engineering による多大な貢献があります。OpenSearch バージョンのプラグインは Elasticsearch LTR プラグインから派生しています。詳細なステップや API の説明など、完全なドキュメントについては、Learning to Rank ドキュメントで入手可能です。

Learning to Rank には、OpenSearch または Elasticsearch 7.7 以降が必要です。

注記

Learning to Rank プラグインを使用するには、完全な管理者許可が必要です。詳細については、マスターユーザーの変更 を参照してください。

Learning to Rank を開始する

判断リストを提供し、トレーニングデータセットを準備し、Amazon OpenSearch Service 以外でモデルをトレーニングする必要があります。青の部分は、OpenSearch サービスの外部で発生します。


        Learning to Rank プラグインプロセスのサンプル。

ステップ 1: プラグインを初期化する

Learning to Rank プラグインを初期化するには、OpenSearch Service ドメインに次のリクエストを送信します。

PUT _ltr
{ "acknowledged" : true, "shards_acknowledged" : true, "index" : ".ltrstore" }

このコマンドは、機能セットやモデルなどのメタデータ情報を保存する非表示の .ltrstore インデックスを作成します。

ステップ 2: 判断リストを作成する

注記

このステップは、OpenSearch Service 以外で実行する必要があります。

判断リストは、機械学習モデルが学習する例を集めたものです。判断リストには、自分にとって重要なキーワードと、各キーワードのグレード付けされたドキュメントのセットを含める必要があります。

この例では、ムービーデータセットの判断リストがあります。4 のグレードは完全一致を示します。0 のグレードは最も悪い一致を示します。

グレード キーワード ドキュメントID ムービー名
4 rambo 7555 Rambo
3 rambo 1370 Rambo III
3 rambo 1369 Rambo: First Blood Part II
3 rambo 1368 First Blood

判断リストを以下の形式で準備します。

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"

判定リストのより完全な例については、「映画の判断」を参照してください。。

この判断リストは、人間の注釈者の助けを借りて手動で作成することも、分析データからプログラムで推測することもできます。

ステップ 3: 機能セットを構築する

機能とは、ドキュメントの関連性に対応するフィールドです。例えば、titleoverviewpopularity score (再生数) などが表示されます。

各機能の Mustache テンプレートを用いて機能セットを構築します。機能の詳細については、「機能を用いた操作」を参照してください。

この例では、title および overview フィールドを用いて movie_features 機能セットを構築します

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}}" } } } ] } }

元の .ltrstore インデックスのクエリを行うと、機能セットが返されます。

GET _ltr/_featureset

ステップ 4: 機能値のログを取る

機能値は、各機能について BM-25 によって計算された関連性スコアです。

機能セットと判断リストを組み合わせて、機能値のログを取ります。機能のログギングの詳細については、「機能のログギングスコア」を参照してください。

この例では、bool クエリは、フィルターを用いてグレード付けされたドキュメントを取得してから、sltr クエリを用いて機能セットを選択します。ltr_log クエリは、ドキュメントと機能を組み合わせて、対応する機能値のログを取ります。

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" } } } }

以下にレスポンスの例を示します。

{ "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" ] } ] } }

前の例では、1 番目の機能には機能値がありません。これは、1368 に等しい ID が付いたドキュメントのタイトルフィールドに「rambo」というキーワードが表示されていないからです。これは、トレーニングデータで欠落している機能値です。

ステップ 2: トレーニングデータセットを作成する

注記

このステップは、OpenSearch Service 以外で実行する必要があります。

次のステップでは、判断リストと機能値を組み合わせて、トレーニングデータセットを作成します。元の判断リストは次のようになります。

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

それを最終的なトレーニングデータセットに変換します。これは次のようになります。

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

このステップは手動で実行することも、プログラムを記述して自動化することもできます。

ステップ6:アルゴリズムを選択してモデルを構築する

注記

このステップは、OpenSearch Service 以外で実行する必要があります。

トレーニングデータセットを配置したら、次のステップは XGBoost ライブラリまたは Ranklib ライブラリを使用してモデルを構築することです。XgBoost ライブラリと Ranklib ライブラリを使用すると、Lambdamart や Random Forest などの人気モデルを構築できます。

XGBoost と Ranklib を使用してモデルを構築するステップについては、それぞれ「XGBoost」および「RankLib」ドキュメントを参照してください。Amazon SageMaker を使用して XGBoost モデルを構築するには、「XGBoost アルゴリズム」を参照してください。

ステップ 7: モデルをデプロイする

モデルを構築したら、それを Learning to Rank プラグインに展開します。モデルのデプロイの詳細については、「トレーニングされたモデルのアップロード」を参照してください。。

この例では、Ranklib ライブラリを使用して my_ranklib_model モデルを構築します。

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> """ } } }

モデルを表示するには、次のリクエストを送信します。

GET _ltr/_model/my_ranklib_model

ステップ 8: Learning to Rank を用いて検索する

モデルをデプロイしたら、検索する準備ができています。

使用する機能と実行するモデルの名前を用いて sltr クエリを実行します。

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" } } } } }

Learning to Rank では、判断リストの最高グレードを割り当てたため、「Rambo」が最初の結果として表示されます。

{ "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" } } ] } }

Learning to Rank プラグインを使用せずに検索すると、OpenSearch は異なる結果を返します。

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" } } ] } }

モデルがどの程度うまく実行されているかに基づいて、判断リストと機能を調整します。次に、ステップ 2~8 を繰り返して、時間の経過とともにランキング結果を改善します。

Learning to Rank API

Learning to Rank オペレーションを使用して、機能セットとモデルをプログラムで操作します。

ストアを作成する

機能セットやモデルなどのメタデータ情報を保存する非表示の .ltrstore インデックスを作成します。

PUT _ltr

ストアを削除する

非表示の .ltrstore インデックスを削除し、プラグインをリセットします。

DELETE _ltr

機能セットを作成する

機能セットを作成します。

POST _ltr/_featureset/<name_of_features>

機能セットを削除する

機能セットを削除します。

DELETE _ltr/_featureset/<name_of_feature_set>

機能セットを取得する

機能セットを取得します。

GET _ltr/_featureset/<name_of_feature_set>

モデルを作成する

モデルを作成します。

POST _ltr/_featureset/<name_of_feature_set>/_createmodel

モデルを削除する

モデルを削除します。

DELETE _ltr/_model/<name_of_model>

モデルを取得する

モデルを取得します。

GET _ltr/_model/<name_of_model>

統計を取得する

プラグインがどのように動作するかについての情報を提供します。

GET _ltr/_stats

また、フィルターを使用して単一の統計を取得することもできます:

GET _ltr/_stats/<stat>

さらに、情報をクラスター内の単一のノードに制限することもできます。

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 } } }

統計は、次のテーブルに示すように、ノードとクラスターの 2 つのレベルで提供されます。

ノードレベルの統計
フィールド名 説明
request_total_count ランク付けリクエストの合計数。
request_error_count 失敗したリクエストの合計数。
cache すべてのキャッシュ (機能、機能セット、モデル) の統計情報。キャッシュヒットは、ユーザーがプラグインのクエリを行い、モデルがすでにメモリにロードされているときに発生します。
cache.eviction_count キャッシュ削除の数。
cache.hit_count キャッシュヒットの数。
cache.miss_count キャッシュミスの数。キャッシュミスは、ユーザーがプラグインのクエリを行い、モデルがまだメモリにロードされていない場合に発生します。
cache.entry_count キャッシュのエントリの数。
cache.memory_usage_in_bytes 使用メモリの合計 (バイト単位)。
cache.cache_capacity_reached キャッシュ制限に達したかどうかを示します。
クラスターレベルの統計
フィールド名 説明
保存 機能セットとモデルメタデータが保存される場所を示します。(デフォルトは「.ltrstore」です。 それ以外の場合は、ユーザーが指定した名前で、接頭辞に「.ltrstore_」が付きます)。
stores.status インデックスのステータス。
stores.feature_sets 機能セットの数
stores.features_count 機能の数。
stores.model_count モデルの数。
ステータス Feature Store インデックスのステータス (赤、黄、緑) およびサーキットブレーカーの状態 (開または閉) に基づくプラグインのステータス。
cache.cache_capacity_reached キャッシュ制限に達したかどうかを示します。

キャッシュ統計を取得

キャッシュとメモリの使用状況についての統計を返します。

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": { ... } } } }

キャッシュをクリア

プラグインキャッシュをクリアします。これを使用して、モデルをリフレッシュします。

POST _ltr/_clearcache