Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangyan99 committed Jun 5, 2020
1 parent a544404 commit a6d0fa7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions sdk/search/azure-search-documents/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,38 +68,38 @@ client = SearchClient(endpoint="<service endpoint>",
#### Create a SearchIndexClient

Once you have the values of the Cognitive Search Service [service endpoint](https://docs.microsoft.com/en-us/azure/search/search-create-service-portal#get-a-key-and-url-endpoint)
and [api key](https://docs.microsoft.com/en-us/azure/search/search-security-api-keys) you can create the Search Service client:
and [api key](https://docs.microsoft.com/en-us/azure/search/search-security-api-keys) you can create the Search Index client:

```python
from azure.core.credentials import AzureKeyCredential
from azure.search.documents.indexes import SearchIndexClient

credential = AzureKeyCredential("<api key>")

client = SearchIndexClient(endpoint="<service endpoint>"
client = SearchIndexClient(endpoint="<service endpoint>",
credential=credential)
```

#### Create a SearchIndexerClient

Once you have the values of the Cognitive Search Service [service endpoint](https://docs.microsoft.com/en-us/azure/search/search-create-service-portal#get-a-key-and-url-endpoint)
and [api key](https://docs.microsoft.com/en-us/azure/search/search-security-api-keys) you can create the Search Service client:
and [api key](https://docs.microsoft.com/en-us/azure/search/search-security-api-keys) you can create the Search Indexer client:

```python
from azure.core.credentials import AzureKeyCredential
from azure.search.documents.indexes import SearchIndexerClient

credential = AzureKeyCredential("<api key>")

client = SearchIndexerClient(endpoint="<service endpoint>"
client = SearchIndexerClient(endpoint="<service endpoint>",
credential=credential)
```

### Send your first search request

You can use the `SearchClient` you created in the first section above to make a basic search request:
```python
results = client.search(query="spa")
results = client.search(search_text="spa")

print("Hotels containing 'spa' in the name (or other fields):")
for result in results:
Expand Down Expand Up @@ -142,7 +142,7 @@ from azure.core.credentials import AzureKeyCredential
from azure.search.documents import SearchClient
client = SearchClient("<service endpoint>", "<index_name>", AzureKeyCredential("<api key>"))

results = client.search(query="spa")
results = client.search(search_text="spa")

print("Hotels containing 'spa' in the name (or other fields):")
for result in results:
Expand Down Expand Up @@ -268,7 +268,7 @@ client = SearchClient("<service endpoint>", "<index_name>", AzureKeyCredential("
Similarly, `logging_enable` can enable detailed logging for a single operation,
even when it isn't enabled for the client:
```python
result = client.search(query="spa", logging_enable=True)
result = client.search(search_text="spa", logging_enable=True)
```

## Next steps
Expand Down

0 comments on commit a6d0fa7

Please sign in to comment.