의견 보내기
구조화된 데이터 스토어에서 결과 정렬
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
참고:
이 기능은 미리보기 버전이며 GCP 서비스별 약관 의 'GA 이전 제공 서비스 약관'이 적용됩니다.
GA 이전 제품 및 기능은 지원이 제한될 수 있으며, GA 이전 제품 및 기능의 변경사항이 다른 GA 이전 버전과 호환되지 않을 수 있습니다. 자세한 내용은 출시 단계 설명 을 참조하세요.
또한 이 기능을 사용하면 생성형 AI 미리보기 이용약관 ('미리보기 약관')에 동의하는 것으로 간주됩니다. 이 기능의 경우 Cloud 데이터 처리 추가 조항 에 설명된 대로 개인 정보를 처리할 수 있으며, 여기에는 (미리보기 약관에 정의된) 해당 계약의 제한 및 의무가 적용됩니다.
이 페이지에서는 정형 데이터 스토어 및 메타데이터가 있는 비정형 데이터 스토어에서 실행한 검색어의 결과를 정렬하는 방법을 설명합니다.
결과 정렬에 지원되는 데이터 유형
다음은 검색 결과를 정렬할 수 있는 필드 유형입니다.
string
number
datetime
geolocation
시작하기 전에
정형 데이터 또는 메타데이터가 포함된 비정형 데이터가 포함된 데이터 스토어가 있는 앱이 있는지 확인합니다.
검색 결과 정렬
정형 데이터 스토어 또는 메타데이터가 있는 비정형 데이터 스토어의 검색 결과를 정렬하려면 다음 단계를 따르세요.
REST
API를 사용하여 정형 데이터가 있는 앱 또는 메타데이터가 있는 비정형 데이터의 검색 결과를 정렬하려면 engines.servingConfigs.search
메서드를 사용합니다.
앱 ID를 찾습니다. 앱 ID를 이미 알고 있는 경우 다음 단계로 건너뜁니다.
Google Cloud 콘솔에서 AI 애플리케이션 페이지로 이동합니다.
앱으로 이동
앱 페이지에서 앱 이름을 찾고 ID 열에서 앱 ID를 가져옵니다.
검색어를 만들고 orderBy
필드를 포함합니다.
핵심 용어: Vertex AI Search에서 앱 이라는 용어는 API라는 맥락에서 엔진 이라는 용어와 서로 바꿔서 사용할 수 있습니다.
curl -X POST -H "Authorization: Bearer $( gcloud auth print-access-token) " \
-H "Content-Type: application/json" \
"https://discoveryengine.googleapis.com/v1alpha/projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /servingConfigs/default_search:search" \
-d '{
"servingConfig": "projects/PROJECT_ID /locations/global/collections/default_collection/engines/APP_ID /servingConfigs/default_search",
"query": "QUERY ",
"orderBy": "ORDER_BY "
}'
다음을 바꿉니다.
PROJECT_ID
: Google Cloud 프로젝트의 ID입니다.
APP_ID
: Vertex AI Search 앱의 ID입니다.
QUERY
: 검색할 쿼리 텍스트입니다.
ORDER_BY
: 결과가 정렬되는 순서입니다. 기본 정렬 순서는 오름차순입니다. 예를 들어 date
를 지정하면 가장 오래된 결과부터 가장 최근 결과 순으로 반환됩니다. 내림차순 정렬 순서로 가져오려면 date
값에 desc
를 추가합니다(예: date desc
). 더 많은 예시는 orderBy
예시 를 참조하세요.
명령어 및 결과 예시
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
"https://discoveryengine.googleapis.com/v1alpha/projects/my-project-123/locations/global/collections/default_collection/engines/my-app/servingConfigs/default_search:search" \
-d '{
"query": "hotel",
"orderBy": "rating desc"
}'
{
"results": [
{
"id": "10d480b19c256bb1",
"document": {
"name": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/10d480b19c256bb1",
"id": "10d480b19c256bb1",
"structData": {
"available_date": "2023-11-05",
"amenities": [
"Lake Views",
"Private Beach",
"Spa",
"Water Activities"
],
"room_types": [
"Lakefront Suite",
"Deluxe Room",
"Cottage"
],
"location": {
"address": "988 Serenity Circle, Tranquil Town, NV 89501, USA"
},
"rating": 4.6,
"id": 11,
"price_per_night": 220.5,
"title": "Serenity Springs Hotel"
}
}
},
{
"id": "9ffae8af37cc8b63",
"document": {
"name": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/9ffae8af37cc8b63",
"id": "9ffae8af37cc8b63",
"structData": {
"title": "Riverfront Plaza Hotel",
"rating": 4.2,
"location": {
"address": "101 Main St, Anytown, CA 94501, USA"
},
"price_per_night": 145.8,
"amenities": [
"Fitness Center",
"Conference Rooms",
"Restaurant",
"Valet Parking"
],
"id": 3,
"room_types": [
"Executive Suite",
"King Room",
"Double Queen"
],
"available_date": "2023-11-15"
}
}
},
{
"id": "3be9e854d8f3a47f",
"document": {
"name": "projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/3be9e854d8f3a47f",
"id": "3be9e854d8f3a47f",
"structData": {
"amenities": [
"Oceanfront Views",
"Pool",
"Spa",
"Beachside Dining"
],
"available_date": "2023-09-18",
"location": {
"address": "449 Oceanfront Drive, Seaside Resort, CA 92007, USA"
},
"id": 13,
"title": "Ocean Breeze Hotel",
"room_types": [
"Ocean View Suite",
"Deluxe Room",
"Family Suite"
],
"rating": 4.1,
"price_per_night": 180
}
}
}
],
"totalSize": 3,
"attributionToken": "wAHwvwoMCNDYz7UGEMCklrsCEiQ2NmIzYmU5My0wMDAwLTIxMDUtYmUyNy01ODI0MjljMzdlZTQiB0dFTkVSSUMqgAHd1akt3e2ILebtiC2CspoigLKaIpjeqC-q-LMtjr6dFeqCsS2W3qgvwvCeFaz4sy2jgJcinta3LeiCsS3b7Ygt5O2ILa3Eii3Usp0Vpp-VLZzWty359rMt-_azLaCJsy3dj5oixcvzF6vEii2iibMttreMLd_VqS3bj5oipJ-VLQ",
"guidedSearchResult": {},
"summary": {}
}
이 예시에서는 '호텔'이라는 단어가 포함된 문서가 평점이 4.6인 Serenity Springs Hotel부터 평점이 4.1인 Ocean Breeze Hotel까지 평점순으로 정렬되어 있습니다.
orderBy
예시
title
이라는 문자열 필드에서 정렬하는 방식:
rating
이라는 숫자 필드에서 정렬하는 방식:
available_date
라는 날짜/시간 필드에서 정렬하는 방식:
location
이라는 필드에서 위치정보에 따라 정렬하는 방식:
"orderBy": "GEO_DISTANCE(location, \"Mountain View, CA\")"
: 마운틴뷰에서 가장 가까운 순서부터 가장 먼 순서로 문서를 정렬합니다.
"orderBy": "GEO_DISTANCE(location, 37.38, -122.08) desc"
: 37.38°N, 122.08°W 위치에서 가장 먼 순서부터 가장 가까운 순서로 문서를 정렬합니다.
의견 보내기
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스 에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스 에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책 을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-14(UTC)
의견을 전달하고 싶나요?
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-14(UTC)"],[[["This feature allows users to order search results from both structured and unstructured data stores with metadata."],["Supported field types for ordering include string, number, datetime, and geolocation."],["The `engines.servingConfigs.search` method is recommended for ordering search results when using the API, and can be used with an engine/app or a data store."],["The `orderBy` field in the search query allows you to specify the field and the desired sort order (ascending or descending), for example sorting by title, rating, or a date."],["Geolocation-based ordering is supported using `GEO_DISTANCE` to order results by proximity to a specified location, which can be an address or latitude and longitude."]]],[]]