Peter J
Peter J

Reputation: 23

Is it possible to Push (using API) and Pull (using indexer) data into the same Index with Azure Search?

I have an index in Azure Search lets says called Hotels.

I have a hotels table in Azure SQL that has the same schema that is a copy of the hotels index found in Azure Search.

I push from my back-end to Azure SQL table and Azure Search at create/update/delete.

In a scenario my data was pushed to Azure SQL but failed to be pushed to Azure Search is it possible to have my Azure SQL Hotels table be an indexer, such that the indexer could sync data to my Azure Search index (hotels) that failed to be pushed from my backend?

Upvotes: 2

Views: 848

Answers (1)

Pablo Castro
Pablo Castro

Reputation: 1681

Yes, you can both mix push and pull as well as have multiple pull indexers targeting the same index. We see this done often when part of the data is in one data source and part in another, where the index is the point where they converge, coordinated by their key.

The pattern you're describing is not as common, but generally speaking it should work. You'd have to account for cases where your write conflicts with an indexer write, and make sure the writes you do as they happen ultimately win. Also if you go down this path make sure to configure a change detection (and deletion detection if you delete rows) policy so we index from SQL incrementally and don't ready everything on every run.

An alternative approach if you're worried about missing writes is to push all your writes into a queue, and then pull from the queue and into Azure Search. That way you have a single stream of writes instead of two.

Upvotes: 2

Related Questions