1

I have 2 documents in a partition of document db. How can I combine these 2 documents and prepare one document which I can send as a Data Source for Azure Search Service.

I found a way by stored procedure we can combine 2 documents. Now I am facing a difficult scenario. Can we use a stored procedure in the query part of Azure search Data Source?

Jay Gong
  • 23,163
  • 2
  • 27
  • 32
zile
  • 109
  • 11
  • Not quite sure what you're asking, but... seems like you'd have to do this yourself (e.g. read in your two documents and create a new document, via code). There is no "merge documents" functionality built-in. – David Makogon Nov 23 '18 at 04:38
  • I am looking for a solution to read all the documents by partition key.. is it possible by stored procedure.. – zile Nov 23 '18 at 06:11
  • It's possible by both a stored procedure or any of the SDKs – Nick Chapsas Nov 23 '18 at 08:51
  • You can't call a stored procedure from Azure Search datasource's query. You can probably write a query that groups documents by partition, then flattens each group into a document with the structure corresponding to your Azure Search index – Eugene Shvets Nov 23 '18 at 18:20
  • @shree Hi, if you think my answer helps you,you could mark it for answer. – Jay Gong Dec 03 '18 at 05:53

1 Answers1

1

I am looking for a solution to read all the documents by partition key.. is it possible by stored procedure.

Of course,it is possible to call the stored procedure by partition key. In fact, the partition key is necessary. You could refer to my previous case for more details:Azure Cosmos DB asking for partition key for store procedure.

Based on my researching, stored procedure can't be invoked in azure search data source.You could only configure sql database,cosmos db, blob storage ,table storage etc. So, I suggest you using Azure Function Http Trigger to call your stored procedure with sdk then save the combined document into new collection or save it as json file into blob storage corresponding to your Azure Search index.

Jay Gong
  • 23,163
  • 2
  • 27
  • 32
  • This answer is correct. Please upvote this uservoice feature: https://feedback.azure.com/forums/263029-azure-search/suggestions/18346210-allow-indexers-to-call-documentdb-stored-procedure and the Azure search team will attempt to prioritize it based on resources and customer interest – Arvind - MSFT Nov 26 '18 at 17:17