I am using Azure Search in full query mode on top of CosmosDB and I want to run a query for any documents with a field that contains the string "azy do". This should match, for example, a document containing "lazy dog".
Reading the Azure Search documentation, it looks like this is impossible due to the term-based indexes it uses.
Rejected solutions
0 matches since it is looking for whole words:
"azy do"
Doesn't work since regexes are not allowed to span multiple terms:
/.*azy do.*/
This "works", to the extent that it will match "lazy dog", but this does not respect the ordering of the query and will also match "dog lazy", for example
/.*azy.*/ AND /.*do.*/
Is there any way of doing this correctly in Azure Search?
If you want to test a potential solution, you can modify the search
variable in this JSFiddle that is using a demo Microsoft instance of Azure Search.
It doesn't appear that this exact scenario is possible if I understand correctly.
Without the regex wildcard you could do a proximity search:
var search = '"business budget"~3';
Here's a link for more reading:
https://learn.microsoft.com/en-us/rest/api/searchservice/lucene-query-syntax-in-azure-search