Search code examples
azure-cognitive-search

How to search within a specific document


The use case I have is that I would like to use the azure search "hit" highlighting to check (and visulize) if a set of key words exists for a specific key id (e.g. my_id).

Example query:

/docs?api-version=2020-06-30&search="search term 1" OR "search term 2" OR "search term 3"

AND my_id = "some id"

(As opposed to searching across the entire database and getting multiple document hits).

But not matter what variation I can't seem to limit the search scope to just a specific document?

Any help or guidance would be much apreciated!

UPDATE 13-OCT-2020

The solution was based on two issues:

  1. Postman encoded = for the filter
  2. The Guid had to be entered surrounded by single quotes

Thanks to @ramero-MSFT for the assistance!


Solution

  • You can use filters to limit the scope of documents to search in -> https://learn.microsoft.com/en-us/azure/search/search-filters

    Make sure the "key" field is marked as filterable in your index.