Skip to content

Commit 782eb7f

Browse files
committed
Tested and updated Python quickstart to use VS Code
1 parent ef477d2 commit 782eb7f

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.author: heidist
88
ms.service: cognitive-search
99
ms.devlang: python
1010
ms.topic: quickstart
11-
ms.date: 08/29/2022
11+
ms.date: 08/31/2022
1212
ms.custom: devx-track-python, mode-api
1313
---
1414

@@ -52,11 +52,14 @@ All requests require an api-key on every request sent to your service. Having a
5252

5353
In this task, start Jupyter Notebook and verify that you can connect to Azure Cognitive Search. You'll do this step by requesting a list of indexes from your service.
5454

55-
1. Create a new Python3 notebook.
55+
1. Create a new Python3 notebook in Visual Studio Code:
56+
57+
1. Press F1 and search for "Python Select Interpreter" and choose a version of Python 3.7 or later.
58+
1. Press F1 again and search for "Create: New Jupyter Notebook". You should have an empty, untitled .ipynb file open in the editor ready for the first entry.
5659

5760
1. In the first cell, load the libraries from the Azure SDK for Python, including [azure-search-documents](/python/api/azure-search-documents).
5861

59-
```python
62+
```python
6063
%pip install azure-search-documents --pre
6164
%pip show azure-search-documents
6265

@@ -73,11 +76,11 @@ In this task, start Jupyter Notebook and verify that you can connect to Azure Co
7376
SimpleField,
7477
SearchableField
7578
)
76-
```
79+
```
7780

78-
1. In the second cell, input the request elements that will be constants on every request. Provide your search service name, admin API key, and query API key, copied in a previous step. This cell also sets up the clients you'll use for specific operations: [SearchIndexClient](/python/api/azure-search-documents/azure.search.documents.indexes.searchindexclient) to create an index, and [SearchClient](/python/api/azure-search-documents/azure.search.documents.searchclient) to query an index.
81+
1. Add a second cell and paste in the input the request elements that will be constants on every request. Provide your search service name, admin API key, and query API key, copied in a previous step. This cell also sets up the clients you'll use for specific operations: [SearchIndexClient](/python/api/azure-search-documents/azure.search.documents.indexes.searchindexclient) to create an index, and [SearchClient](/python/api/azure-search-documents/azure.search.documents.searchclient) to query an index.
7982

80-
```python
83+
```python
8184
service_name = "YOUR-SEARCH-SERVICE-NAME"
8285
admin_key = "YOUR-SEARCH-SERVICE-ADMIN-API-KEY"
8386

@@ -92,17 +95,17 @@ In this task, start Jupyter Notebook and verify that you can connect to Azure Co
9295
search_client = SearchClient(endpoint=endpoint,
9396
index_name=index_name,
9497
credential=AzureKeyCredential(admin_key))
95-
```
98+
```
9699

97100
1. In the third cell, run a delete_index operation to clear your service of any existing *hotels-quickstart* indexes. Deleting the index allows you to create another *hotels-quickstart* index of the same name.
98101

99-
```python
102+
```python
100103
try:
101104
result = admin_client.delete_index(index_name)
102105
print ('Index', index_name, 'Deleted')
103106
except Exception as ex:
104107
print (ex)
105-
```
108+
```
106109

107110
1. Run each step.
108111

0 commit comments

Comments
 (0)