Search code examples
azuresearchazure-cognitive-searchazure-data-lake-gen2

How to return average value - Azure Cognitive search or Semantic search query


How to use semantic search(or querytype=simple) and return average of a field. For example, I have a sample csv file with tabular data in my datalake blob container I want to use azure semantic search and find the average age of employees I generated the semantic search indexer,indexes etc along with azure Datalake as DataSource where I uploaded my CSV file.Now I want to send semantic search query to the API and get meaningful insights as API response

Here are some of the sample queries I tried(pasted below).How to properly sent JSON parameters to API and return average age. (Similar to SQL query SELECT AVG(age) FROM EMPLOYEES)

Is there a way I can fetch insights(in JSON format) from the table of records in my CSV file/DataLake.How can I generate insights and fetch those insights through my semantic search API call?

Is there anything wrong with my query I am sending to the API? How can I get more insights in JSON format. enter image description here

enter image description here


Solution

  • Semantic search will only return verbatim statements from your index. It cannot calculate the average from tabular data. See documentation for Returning a semantic answer:

    A semantic answer is a substructure of a semantic query response. It consists of one or more verbatim passages from a search document, formulated as an answer to a query that looks like a question. To return an answer, phrases or sentences must exist in a search document that have the language characteristics of an answer, and the query itself must be posed as a question.