Amazon OpenSearch Service용 순위 학습 - 아마존 OpenSearch 서비스

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

Amazon OpenSearch Service용 순위 학습

OpenSearch는 BM-25라는 확률 순위 프레임워크를 사용하여 관련성 점수를 계산합니다. 문서에 고유 키워드가 더 자주 나타나는 경우 BM-25는 해당 문서에 더 높은 관련성 점수를 할당합니다. 그러나 이 프레임워크는 클릭 광고 데이터와 같은 사용자 동작을 고려하지 않으므로 관련성을 더욱 향상시킬 수 있습니다.

순위 학습은 기계 학습 및 행동 데이터를 사용하여 문서의 관련성을 조정할 수 있는 오픈 소스 플러그 인입니다. 이는 XGBoost 및 Ranklib 라이브러리의 모델을 사용하여 검색 결과를 다시 작성합니다. Elasticsearch LTR 플러그 인은 초기에 OpenSource Connections에 의해 개발되었으며, Wikimedia Foundation, Snagajob Engineering, Bonsai, Yelp Engineering에게서 중요한 기여를 받았습니다. 플러그 인의 OpenSearch 버전은 Elasticsearch LTR 플러그 인에서 파생됩니다. 자세한 단계 및 API 설명을 포함한 전체 설명서는 순위 학습 설명서에서 확인할 수 있습니다.

순위 학습에는 OpenSearch 또는 Elasticsearch 7.7 이상이 필요합니다.

참고

순위 학습 플러그인을 사용하려면 전체 관리자 권한이 있어야 합니다. 자세한 내용은 마스터 사용자 수정 섹션을 참조하세요.

순위 학습 시작하기

판단 목록을 제공하고, 교육 데이터 세트를 준비하며, Amazon OpenSearch Service 외부에서 모델을 교육해야 합니다. 파란색으로 표시된 부분은 OpenSearch Service 외부에서 발생합니다.


        샘플 순위 학습 플러그인 프로세스.

1단계: 플러그인 초기화

순위 학습 플러그인을 초기화하려면 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단계: 기능 집합 작성

기능은 문서의 관련성에 해당하는 필드입니다(예:title, overview, popularity score(뷰 수) 등).

각 기능에 대한 Mustache 템플릿을 사용하여 기능 집합을 작성합니다. 기능에 대한 자세한 내용은 기능 작업을 참조하세요.

이 예제에서는 titleoverview 필드를 사용하여 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" ] } ] } }

앞의 예제에서는 ID가 1368인 문서의 제목 필드에 “rambo”라는 키워드가 나타나지 않기 때문에 첫 번째 기능에는 기능 값이 없습니다. 이 값은 교육 데이터에서 누락된 기능 값입니다.

5단계: 교육 데이터 세트 생성

참고

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 Forests 등과 같은 인기 모델을 구축할 수 있습니다.

XGBoost와 Ranklib를 사용하여 모델을 구축하는 단계는 XGBoostRankLib 설명서를 각각 참조하세요. Amazon SageMaker를 사용하여 XGBoost 모델을 구축하려면 XGBoost 알고리즘을 참조하세요.

7단계: 모델 배포

모델을 구축한 후 순위 학습 플러그인에 배포합니다. 모델 배포에 대한 자세한 내용은 훈련된 모델 업로드를 참조하세요.

이 예제에서는 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단계: 순위 학습으로 검색

모델을 배포하면 검색할 준비가 됩니다.

사용 중인 기능 및 실행하려는 모델의 이름으로 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" } } } } }

“Rambo”를 판단 목록에서 최고 등급으로 지정했기 때문에 순위 학습에서 “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" } } ] } }

순위 학습 플러그인을 사용하지 않고 검색하는 경우 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단계를 반복하여 시간에 따른 순위 결과를 개선합니다.

순위 학습 API

순위 학습 작업을 사용하여 기능 집합 및 모델을 프로그래밍 방식으로 작업할 수 있습니다.

스토어 생성

기능 집합 및 모델과 같은 메타데이터 정보를 저장하는 숨겨진 .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 } } }

통계는 다음 표에 지정된 대로 노드 및 클러스터의 두 수준에서 제공됩니다.

노드 수준 통계
필드 이름 Description
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 캐시 제한에 도달했는지를 나타냅니다.
클러스터 수준 통계
필드 이름 Description
스토어 기능 집합과 모델 메타데이터가 저장되는 위치를 나타냅니다. (기본값은 “.ltrstore”입니다. 그렇지 않으면 접두사가 “.ltrstore_”이고 사용자가 제공한 이름이 붙습니다.)
stores.status 인덱스 상태입니다.
stores.feature_sets 기능 세트 수입니다.
stores.features_count 기능 수입니다.
stores.model_count 모델 수입니다.
상태 특성 저장소 인덱스(빨간색, 노란색 또는 녹색) 및 회로 차단기 상태(열림 또는 닫힘)를 기반으로 하는 플러그인 상태입니다.
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