본문 바로가기
WIKI 기술 지식 베이스

Search Model API

원문 보기 위키 갱신

출처: 문서

본문

모델 검색 API

이 명령을 사용하여 이미 생성한 모델을 검색할 수 있어요.

응답에는 액세스 권한이 있는 모델 버전만 포함돼요. 예를 들어 match_all 쿼리를 보내면 다음 모델 그룹 유형에 대한 모델 버전이 반환돼요:

  • 인덱스의 모든 공개 모델 그룹
  • 여러분이 모델 소유자인 비공개 모델 그룹
  • 여러분의 백엔드 역할과 하나 이상의 백엔드 역할을 공유하는 모델 그룹

이 API의 사용자 액세스에 대한 자세한 내용은 모델 액세스 제어 고려 사항을 참조하세요.

엔드포인트

GET /_plugins/_ml/models/_search
POST /_plugins/_ml/models/_search

예시 요청: 모든 모델 검색

POST /_plugins/_ml/models/_search
{
  "query": {
    "match_all": {}
  },
  "size": 1000
}

{% include copy-curl.html %}

예시 요청: "FIT_RCF" 알고리즘으로 모델 검색

POST /_plugins/_ml/models/_search
{
  "query": {
    "term": {
      "algorithm": {
        "value": "FIT_RCF"
      }
    }
  }
}

{% include copy-curl.html %}

예시: 모델 청크 제외

GET /_plugins/_ml/models/_search
{
  "query": {
    "bool": {
      "must_not": {
        "exists": {
          "field": "chunk_number"
        }
      }
    }
  },
  "sort": [
    {
      "created_time": {
        "order": "desc"
      }
    }
  ]
}

{% include copy-curl.html %}

예시: 모든 모델 청크 검색

다음 쿼리는 ID가 979y9YwBjWKCe6KgNGTm인 모델의 모든 청크를 검색하고 청크를 오름차순으로 정렬해요:

GET /_plugins/_ml/models/_search
{
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "model_id": "9r9w9YwBjWKCe6KgyGST"
          }
        }
      ]
    }
  },
  "sort": [
    {
      "chunk_number": {
        "order": "asc"
      }
    }
  ]
}

{% include copy-curl.html %}

예시: 설명으로 모델 검색

GET _plugins/_ml/models/_search
{
  "query": {
    "bool": {
      "should": [
        {
          "match": {
            "description": "sentence transformer"
          }
        }
      ],
      "must_not": {
        "exists": {
          "field": "chunk_number"
        }
      }
    }
  },
  "size": 1000
}

{% include copy-curl.html %}

예시 응답

{
    "took" : 8,
    "timed_out" : false,
    "_shards" : {
      "total" : 1,
      "successful" : 1,
      "skipped" : 0,
      "failed" : 0
    },
    "hits" : {
      "total" : {
        "value" : 2,
        "relation" : "eq"
      },
      "max_score" : 2.4159138,
      "hits" : [
        {
          "_index" : ".plugins-ml-model",
          "_id" : "-QkKJX8BvytMh9aUeuLD",
          "_version" : 1,
          "_seq_no" : 12,
          "_primary_term" : 15,
          "_score" : 2.4159138,
          "_source" : {
            "name" : "FIT_RCF",
            "version" : 1,
            "content" : "xxx",
            "algorithm" : "FIT_RCF"
          }
        },
        {
          "_index" : ".plugins-ml-model",
          "_id" : "OxkvHn8BNJ65KnIpck8x",
          "_version" : 1,
          "_seq_no" : 2,
          "_primary_term" : 8,
          "_score" : 2.4159138,
          "_source" : {
            "name" : "FIT_RCF",
            "version" : 1,
            "content" : "xxx",
            "algorithm" : "FIT_RCF"
          }
        }
      ]
    }
  }

더 알아보기 (Learn more)