-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Azure Blob Storage #49
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"Services": [ | ||
{ | ||
"Url": "https://9hs2v7a4ca.execute-api.us-east-1.amazonaws.com/prod", | ||
"Paging": { | ||
"OffsetType": "cursor", | ||
"NextPageKey": "body.EnumerationResults.NextMarker", | ||
"PageSize": 20, | ||
"Parameters": { | ||
"Offset": "marker", | ||
"Limit": "maxresults" | ||
} | ||
}, | ||
"Endpoints": [ | ||
{ | ||
"Method": "POST", | ||
"PayloadJsonContent": "{\"url\": \"https://[YOURSTORAGE].blob.core.windows.net/[CONTAINER]?si=all&spr=https&sv=2022-11-02&sr=c&sig=[SAS]&restype=container&comp=list\"}", | ||
"Path": "/", | ||
"ItemPath": "body.EnumerationResults.Blobs.Blob", | ||
"ItemType": "Document", | ||
"Uri": "https://[YOURSTORAGE].blob.core.windows.net/[CONTAINER]/%[Name]", | ||
"ClickableUri": "https://[YOURSTORAGE].blob.core.windows.net/[CONTAINER]/%[Name]", | ||
"Title": "%[Name]", | ||
"ModifiedDate": "%[Properties.Last-Modified]", | ||
"Metadata": { | ||
"id": "%[Name]" | ||
}, | ||
"SubQueries": [ | ||
{ | ||
"Path": "https://[YOURSTORAGE].blob.core.windows.net/[CONTAINER]/%[coveo_parent.id]", | ||
"Method": "GET", | ||
"QueryParameters": { | ||
"si": "all", | ||
"spr": "https", | ||
"sv": "2022-11-02", | ||
"sr": "c", | ||
"sig": "[SAS]" | ||
}, | ||
"IsBinaryBody": true | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,49 @@ | ||||||
# Indexing Azure Blob Storage Using the REST API Connector | ||||||
|
||||||
## Use Case | ||||||
|
||||||
This example shows how to index Azure Blob Storage files from a specific container. | ||||||
|
||||||
- List Blobs in the container: `&restype=container&comp=list` | ||||||
- `maxresults`: maximum number of results to fetch | ||||||
- return: `NextMarker` for next call | ||||||
- then use `marker` parameter in URI | ||||||
- Get the actual blob is using the container name + the name of the document | ||||||
|
||||||
## Enable logging in your JSON of the source | ||||||
|
||||||
Add to the `parameters`: | ||||||
|
||||||
```json | ||||||
"Log4netLoggers": { | ||||||
"value": "{ \"Coveo.Connectors.GenericRest\": \"TRACE\", \"Coveo.CES.CustomCrawlers.GenericRest\": \"TRACE\", \"Coveo.Platform\": \"TRACE\" }" | ||||||
}, | ||||||
"Log4netAppenderName": { | ||||||
"value": "AsyncBufferingForwardingAppender" | ||||||
}, | ||||||
``` | ||||||
|
||||||
## Prerequisites | ||||||
|
||||||
To fully understand how to use this example, you must: | ||||||
|
||||||
1. Have a Coveo Platform organization. | ||||||
2. Learn about [Coveo Connectivity](https://docs.coveo.com/en/1702/). | ||||||
3. Learn [how to configure a REST API source](https://docs.coveo.com/en/1896/). | ||||||
|
||||||
## Instructions | ||||||
|
||||||
1. [Create an Access Policy](https://portal.azure.com/#view/Microsoft_Azure_Storage/ContainerMenuBlade/~/accesspolicy/storageAccountId/). Make sure to enable `Read` and `List`. | ||||||
2. [Create an Shared Access Token](https://portal.azure.com/#view/Microsoft_Azure_Storage/ContainerMenuBlade/~/sas/storageAccountId). Use Stored Access Policy from Step 1. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
3. Generate SAS token and URL. Use the Blob SAS URL for the Generic Rest Configuration. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
4. Create a REST API source. | ||||||
5. Use the example in [`SourceJSONConfig.json`](https://github.com/coveooss/connectivity-library/blob/master/Azure%20Blob%20Storage/Config.json) as a base to build your source JSON configuration. Replace the [YOURSTORAGE] and [CONTAINER] to your own. Also replace all the SAS token parameters in all requests. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
6. [Create the appropiate fields and mappings](https://docs.coveo.com/en/1896/#completion). | ||||||
|
||||||
## Limitation | ||||||
|
||||||
Content [refresh](https://docs.coveo.com/en/2039/#refresh) isn't possible, not supported by the `List Blobs` API call. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
## Reference | ||||||
|
||||||
[Azure Storage API documentation](https://learn.microsoft.com/en-us/rest/api/storageservices/list-blobs?tabs=azure-ad) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I get this part, do you mind adding a bit of context?