SridharVenkat SridharVenkat - 1 month ago 13
C# Question

Azure Search; Search inside a specific field

In Azure Search can i do searching on specific field(s)

Example: I have the below "Research" Index.

{
"Error": null,
"IsSuccess": true,
"StatusCode": 201,
"Body": {
"name": "Research",
"fields": [
{
"name": "Id",
"type": "Edm.String",
"searchable": false,
"filterable": false,
"sortable": false,
"facetable": false,
"suggestions": false,
"key": true,
"retrievable": true
},
{
"name": "Title",
"type": "Edm.String",
"searchable": true,
"filterable": false,
"sortable": false,
"facetable": false,
"suggestions": true,
"key": false,
"retrievable": true
},
{
"name": "Description",
"type": "Edm.String",
"searchable": true,
"filterable": false,
"sortable": false,
"facetable": false,
"suggestions": true,
"key": false,
"retrievable": true
},
{
"name": "Questions",
"type": "Collection(Edm.String)",
"searchable": true,
"filterable": false,
"sortable": false,
"facetable": false,
"suggestions": true,
"key": false,
"retrievable": true
},
],
"scoringProfiles": [],
"defaultScoringProfile": null,
"corsOptions": null
}
}


Now in the search query can I ask Azure to search only in the "Questions" field?

E.g. When user search for "How Internet of things benefits automotive industry?" and selects i want to find this in only "Questions" would i able to do that.

Answer

Yes, this is possible using the searchFields=[string] parameter. For example, in your case you would add &searchFields=Questions to your URL search request. You can learn more about this here: https://msdn.microsoft.com/en-us/library/azure/dn798927.aspx