Reputation: 7692
I am using Azure search and when I add a new field it becomes null.
Is there a way to have a default value?
PUT {{servicename}}/indexes/{{indexname}}?api-version=2019-05-06
Content-Type: application/json
api-key: {{adminkey}}
{
"fields": [
{
"name": "rid",
"type": "Edm.String",
"searchable": false,
"filterable": false,
"sortable": false,
"facetable": false,
"key": true
},
{
"name": "NewField",
"type": "Edm.Boolean"
}
}
and search result is
{
"@odata.context": "https://whatever.search.windows.net/indexes('indexname')/$metadata#docs(*)",
"value": [
{
"@search.score": 0.55735236,
"rid": "asdfasdf",
"Email": null
}
]
}
Upvotes: 0
Views: 740
Reputation: 136196
Is there a way to have a default value?
Based on the documentation
, no.
Once a new field is added, you will have to update
existing documents manually to set a value for that added field. As mentioned in the documentation, you can use merge
as @search.action
to only update the newly added fields.
Upvotes: 1