Last active
March 29, 2019 18:05
-
-
Save paddy74/eb965a02eaf9597a9236d146e40ea62e to your computer and use it in GitHub Desktop.
Searching Documents from Azure Search using cUrl (with decoding & JSON Pretify)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
SERVICE_NAME='<Azure Search Service Name>' | |
API_VER='2017-11-11' | |
ADMIN_KEY='<API KEY>' | |
CONTENT_TYPE='application/json' | |
INDEX_NAME='Azure Search Service index name>' | |
URL="https://$SERVICE_NAME.search.windows.net/indexes/$INDEX_NAME/docs?api-version=$API_VER" | |
{ | |
curl -s\ | |
-H "Content-Type: $CONTENT_TYPE"\ | |
-H "api-key: $ADMIN_KEY"\ | |
-XGET $URL\ | |
"&search=hello%20world"\ | |
"&\$top=5" | |
} | python -mjson.tool| perl -Xpne 's/\\u([0-9a-fA-F]{4})/chr(hex($1))/eg' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment