Skip to content

Commit 5fe3893

Browse files
committed
quickstart pivots for entra and apikey
1 parent 7e4d2fe commit 5fe3893

File tree

1 file changed

+135
-130
lines changed

1 file changed

+135
-130
lines changed

articles/search/search-get-started-vector.md

Lines changed: 135 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,20 @@ You use one `.rest` or `.http` file to run all the requests in this quickstart.
8686
For the **recommended** keyless authentication via Microsoft Entra ID, you need to replace `@apiKey` with the `@token` variable.
8787

8888
```http
89-
@baseUrl = PUT-YOUR-SEARCH-SERVICE-URL-HERE
9089
@token = PUT-YOUR-MICROSOFT-ENTRA-TOKEN-HERE
9190
```
9291

9392
If you prefer to use an API key, replace `@apiKey` with the key you copied from the Azure portal.
9493

9594
```http
96-
@baseUrl = PUT-YOUR-SEARCH-SERVICE-URL-HERE
9795
@apiKey = PUT-YOUR-ADMIN-KEY-HERE
9896
```
9997

10098
1. For the **recommended** keyless authentication via Microsoft Entra ID, you need to replace `api-key: {{apiKey}}` with `Authorization: Bearer {{token}}` in the request headers. Replace all instances of `api-key: {{apiKey}}` that you find in the file.
10199

102100

103101
## Create a vector index
102+
104103
You use the [Create Index](/rest/api/searchservice/indexes/create) REST API to create a vector index and set up the physical data structures on your search service.
105104

106105
The index schema in this example is organized around hotel content. Sample data consists of vector and nonvector names and descriptions of fictitious hotels. This schema includes configurations for vector indexing and queries, and for semantic ranking.
@@ -327,7 +326,7 @@ The response body should include the JSON representation of the index schema.
327326
328327
```json
329328
{
330-
"@odata.context": "https://contoso-search-centralus.search.windows.net/$metadata#indexes/$entity",
329+
"@odata.context": "https://my-demo-search.search.windows.net/$metadata#indexes/$entity",
331330
"@odata.etag": "\"0x8DD2E70E6C36D8E\"",
332331
"name": "hotels-vector-quickstart",
333332
"defaultScoringProfile": null,
@@ -584,7 +583,7 @@ In Azure AI Search, the index contains all searchable data and queries run on th
584583
> [!IMPORTANT]
585584
> The code in this example isn't runable. Several characters or lines are removed for brevity. Use the code in your `az-search-vector-quickstart.rest` file to run the request.
586585
587-
1. Select **Send request**. You should have an `HTTP/1.1 201 Created` response. The response body should include the JSON representation of the search documents.
586+
1. Select **Send request**. You should have an `HTTP/1.1 200 OK` response. The response body should include the JSON representation of the search documents.
588587
589588
Key takeaways about the [Documents - Index REST API](/rest/api/searchservice/documents/) request:
590589
@@ -614,11 +613,11 @@ The vector query string is semantically similar to the search string, but it inc
614613
615614
1. In Visual Studio Code, open the `az-search-vector-quickstart.rest` file you created earlier.
616615
617-
1. Find the `### Run a query` code block in the file. This block contains the request to query the search index.
616+
1. Find the `### Run a single vector query` code block in the file. This block contains the request to query the search index.
618617
619618
620619
```http
621-
### Run a query
620+
### Run a single vector query
622621
POST {{baseUrl}}/indexes/hotels-vector-quickstart/docs/search?api-version=2023-11-01 HTTP/1.1
623622
Content-Type: application/json
624623
Authorization: Bearer {{token}}
@@ -653,45 +652,59 @@ The response for the vector equivalent of `classic lodging near running trails,
653652
654653
```json
655654
{
656-
"@odata.context": "https://my-demo-search.search.windows.net/indexes('hotels-vector-quickstart')/$metadata#docs(*)",
657-
"@odata.count": 7,
658-
"value": [
659-
{
660-
"@search.score": 0.857736,
661-
"HotelName": "Nordick's Valley Motel",
662-
"Description": "Only 90 miles (about 2 hours) from the nation's capital and nearby most everything the historic valley has to offer. Hiking? Wine Tasting? Exploring the caverns? It's all nearby and we have specially priced packages to help make our B&B your home base for fun while visiting the valley."
663-
},
664-
{
665-
"@search.score": 0.8399129,
666-
"HotelName": "Swirling Currents Hotel",
667-
"Description": "Spacious rooms, glamorous suites and residences, rooftop pool, walking access to shopping, dining, entertainment and the city center."
668-
},
669-
{
670-
"@search.score": 0.8383954,
671-
"HotelName": "Luxury Lion Resort",
672-
"Description": "Unmatched Luxury. Visit our downtown hotel to indulge in luxury accommodations. Moments from the stadium, we feature the best in comfort"
673-
},
674-
{
675-
"@search.score": 0.8254346,
676-
"HotelName": "Sublime Palace Hotel",
677-
"Description": "Sublime Palace Hotel is located in the heart of the historic center of Sublime in an extremely vibrant and lively area within short walking distance to the sites and landmarks of the city and is surrounded by the extraordinary beauty of churches, buildings, shops and monuments. Sublime Palace is part of a lovingly restored 1800 palace."
678-
},
679-
{
680-
"@search.score": 0.82380056,
681-
"HotelName": "Stay-Kay City Hotel",
682-
"Description": "The hotel is ideally located on the main commercial artery of the city in the heart of New York."
683-
},
684-
{
685-
"@search.score": 0.81514084,
686-
"HotelName": "Old Century Hotel",
687-
"Description": "The hotel is situated in a nineteenth century plaza, which has been expanded and renovated to the highest architectural standards to create a modern, functional and first-class hotel in which art and unique historical elements coexist with the most modern comforts."
688-
},
689-
{
690-
"@search.score": 0.8133763,
691-
"HotelName": "Gastronomic Landscape Hotel",
692-
"Description": "The Hotel stands out for its gastronomic excellence under the management of William Dough, who advises on and oversees all of the Hotel’s restaurant services."
693-
}
694-
]
655+
"@odata.context": "https://my-demo-search.search.windows.net/indexes('hotels-vector-quickstart')/$metadata#docs(*)",
656+
"@odata.count": 7,
657+
"value": [
658+
{
659+
"@search.score": 0.85773647,
660+
"HotelId": "48",
661+
"HotelName": "Nordick's Motel",
662+
"Description": "Only 90 miles (about 2 hours) from the nation's capital and nearby most everything the historic valley has to offer. Hiking? Wine Tasting? Exploring the caverns? It's all nearby and we have specially priced packages to help make our B&B your home base for fun while visiting the valley.",
663+
"Category": "Boutique"
664+
},
665+
{
666+
"@search.score": 0.8399132,
667+
"HotelId": "49",
668+
"HotelName": "Old Carrabelle Hotel",
669+
"Description": "Spacious rooms, glamorous suites and residences, rooftop pool, walking access to shopping, dining, entertainment and the city center.",
670+
"Category": "Luxury"
671+
},
672+
{
673+
"@search.score": 0.83839583,
674+
"HotelId": "13",
675+
"HotelName": "Historic Lion Resort",
676+
"Description": "Unmatched Luxury. Visit our downtown hotel to indulge in luxury accommodations. Moments from the stadium, we feature the best in comfort",
677+
"Category": "Resort and Spa"
678+
},
679+
{
680+
"@search.score": 0.82543474,
681+
"HotelId": "4",
682+
"HotelName": "Sublime Cliff Hotel",
683+
"Description": "Sublime Cliff Hotel is located in the heart of the historic center of Sublime in an extremely vibrant and lively area within short walking distance to the sites and landmarks of the city and is surrounded by the extraordinary beauty of churches, buildings, shops and monuments. Sublime Cliff is part of a lovingly restored 1800 palace.",
684+
"Category": "Boutique"
685+
},
686+
{
687+
"@search.score": 0.82380104,
688+
"HotelId": "1",
689+
"HotelName": "Secret Point Hotel",
690+
"Description": "The hotel is ideally located on the main commercial artery of the city in the heart of New York.",
691+
"Category": "Boutique"
692+
},
693+
{
694+
"@search.score": 0.8151413,
695+
"HotelId": "2",
696+
"HotelName": "Twin Dome Hotel",
697+
"Description": "The hotel is situated in a nineteenth century plaza, which has been expanded and renovated to the highest architectural standards to create a modern, functional and first-class hotel in which art and unique historical elements coexist with the most modern comforts.",
698+
"Category": "Boutique"
699+
},
700+
{
701+
"@search.score": 0.8133767,
702+
"HotelId": "3",
703+
"HotelName": "Triple Landscape Hotel",
704+
"Description": "The Hotel stands out for its gastronomic excellence under the management of William Dough, who advises on and oversees all of the Hotel\u2019s restaurant services.",
705+
"Category": "Resort and Spa"
706+
}
707+
]
695708
}
696709
```
697710
@@ -736,40 +749,47 @@ The query was the same as the previous [single vector search example](#single-ve
736749
737750
```json
738751
{
739-
740-
"@odata.count": 3,
741-
"value": [
742-
{
743-
"@search.score": 0.857736,
744-
"HotelName": "Nordick's Valley Motel",
745-
"Description": "Only 90 miles (about 2 hours) from the nation's capital and nearby most everything the historic valley has to offer. Hiking? Wine Tasting? Exploring the caverns? It's all nearby and we have specially priced packages to help make our B&B your home base for fun while visiting the valley.",
746-
"Tags": [
747-
"continental breakfast",
748-
"air conditioning",
749-
"free wifi"
750-
]
751-
},
752-
{
753-
"@search.score": 0.8383954,
754-
"HotelName": "Luxury Lion Resort",
755-
"Description": "Unmatched Luxury. Visit our downtown hotel to indulge in luxury accommodations. Moments from the stadium, we feature the best in comfort",
756-
"Tags": [
757-
"view",
758-
"free wifi",
759-
"pool"
760-
]
761-
},
762-
{
763-
"@search.score": 0.81514084,
764-
"HotelName": "Old Century Hotel",
765-
"Description": "The hotel is situated in a nineteenth century plaza, which has been expanded and renovated to the highest architectural standards to create a modern, functional and first-class hotel in which art and unique historical elements coexist with the most modern comforts.",
766-
"Tags": [
767-
"pool",
768-
"free wifi",
769-
"concierge"
770-
]
771-
}
772-
]
752+
"@odata.context": "https://my-demo-search.search.windows.net/indexes('hotels-vector-quickstart')/$metadata#docs(*)",
753+
"@odata.count": 3,
754+
"value": [
755+
{
756+
"@search.score": 0.85773647,
757+
"HotelId": "48",
758+
"HotelName": "Nordick's Motel",
759+
"Description": "Only 90 miles (about 2 hours) from the nation's capital and nearby most everything the historic valley has to offer. Hiking? Wine Tasting? Exploring the caverns? It's all nearby and we have specially priced packages to help make our B&B your home base for fun while visiting the valley.",
760+
"Category": "Boutique",
761+
"Tags": [
762+
"continental breakfast",
763+
"air conditioning",
764+
"free wifi"
765+
]
766+
},
767+
{
768+
"@search.score": 0.83839583,
769+
"HotelId": "13",
770+
"HotelName": "Historic Lion Resort",
771+
"Description": "Unmatched Luxury. Visit our downtown hotel to indulge in luxury accommodations. Moments from the stadium, we feature the best in comfort",
772+
"Category": "Resort and Spa",
773+
"Tags": [
774+
"view",
775+
"free wifi",
776+
"pool"
777+
]
778+
},
779+
{
780+
"@search.score": 0.8151413,
781+
"HotelId": "2",
782+
"HotelName": "Twin Dome Hotel",
783+
"Description": "The hotel is situated in a nineteenth century plaza, which has been expanded and renovated to the highest architectural standards to create a modern, functional and first-class hotel in which art and unique historical elements coexist with the most modern comforts.",
784+
"Category": "Boutique",
785+
"Tags": [
786+
"pool",
787+
"free wifi",
788+
"air conditioning",
789+
"concierge"
790+
]
791+
}
792+
]
773793
}
774794
```
775795
@@ -980,58 +1000,43 @@ The Swirling Currents Hotel now moves into the top spot. Without semantic rankin
9801000
9811001
```json
9821002
{
983-
"@odata.count": 3,
984-
"@search.facets": {
985-
"Address/StateProvince": [
986-
{
987-
"count": 1,
988-
"value": "NY"
989-
},
990-
{
991-
"count": 1,
992-
"value": "VA"
993-
}
994-
]
995-
},
996-
"@search.answers": [],
997-
"value": [
998-
{
999-
"@search.score": 0.03306011110544205,
1000-
"@search.rerankerScore": 2.5094974040985107,
1001-
"HotelId": "49",
1002-
"HotelName": "Swirling Currents Hotel",
1003-
"Description": "Spacious rooms, glamorous suites and residences, rooftop pool, walking access to shopping, dining, entertainment and the city center.",
1004-
"Category": "Luxury",
1005-
"Address": {
1006-
"City": "Arlington",
1007-
"StateProvince": "VA"
1008-
}
1009-
},
1010-
{
1011-
"@search.score": 0.03306011110544205,
1012-
"@search.rerankerScore": 2.0370211601257324,
1013-
"HotelId": "48",
1014-
"HotelName": "Nordick's Valley Motel",
1015-
"Description": "Only 90 miles (about 2 hours) from the nation's capital and nearby most everything the historic valley has to offer. Hiking? Wine Tasting? Exploring the caverns? It's all nearby and we have specially priced packages to help make our B&B your home base for fun while visiting the valley.",
1016-
"Category": "Boutique",
1017-
"Address": {
1018-
"City": "Washington D.C.",
1019-
"StateProvince": null
1020-
}
1021-
},
1022-
{
1023-
"@search.score": 0.032258063554763794,
1024-
"@search.rerankerScore": 1.6706111431121826,
1025-
"HotelId": "1",
1026-
"HotelName": "Stay-Kay City Hotel",
1027-
"Description": "The hotel is ideally located on the main commercial artery of the city in the heart of New York.",
1028-
"Category": "Boutique",
1029-
"Address": {
1030-
"City": "New York",
1031-
"StateProvince": "NY"
1032-
}
1033-
}
1003+
"@odata.context": "https://my-demo-search.search.windows.net/indexes('hotels-vector-quickstart')/$metadata#docs(*)",
1004+
"@odata.count": 2,
1005+
"@search.facets": {
1006+
"Address/StateProvince": [
1007+
{
1008+
"count": 1,
1009+
"value": "VA"
1010+
}
10341011
]
1012+
},
1013+
"@search.answers": [],
1014+
"value": [
1015+
{
1016+
"@search.score": 0.03306011110544205,
1017+
"@search.rerankerScore": 2.8773112297058105,
1018+
"HotelId": "49",
1019+
"HotelName": "Old Carrabelle Hotel",
1020+
"Description": "Spacious rooms, glamorous suites and residences, rooftop pool, walking access to shopping, dining, entertainment and the city center.",
1021+
"Category": "Luxury",
1022+
"Address": {
1023+
"City": "Arlington",
1024+
"StateProvince": "VA"
1025+
}
1026+
},
1027+
{
1028+
"@search.score": 0.03306011110544205,
1029+
"@search.rerankerScore": 2.1703834533691406,
1030+
"HotelId": "48",
1031+
"HotelName": "Nordick's Motel",
1032+
"Description": "Only 90 miles (about 2 hours) from the nation's capital and nearby most everything the historic valley has to offer. Hiking? Wine Tasting? Exploring the caverns? It's all nearby and we have specially priced packages to help make our B&B your home base for fun while visiting the valley.",
1033+
"Category": "Boutique",
1034+
"Address": {
1035+
"City": "Washington D.C.",
1036+
"StateProvince": null
1037+
}
1038+
}
1039+
]
10351040
}
10361041
```
10371042

0 commit comments

Comments
 (0)