[Feature Request] Default value for fields
Currently, we're using Vespa for realtime application and many kafka stream apps pushing data from kafka into Vespa.
The problem that we face is update document with condition and set. If a document is not exits, it's ok but if other kafka streams push the document without a field, for example A (type int). After that we're using condition and set on that document, plus we using increment A by 1 then nothing happened. Maybe we need some way to declare default value for a field. @bratseth
I also notice that condition and set is doc level, maybe we need something like that at field level. It would be great !!!
Thanks you.
Hi, there is no default value setting for fields in Vespa - you can use https://docs.vespa.ai/documentation/document-processing.html to make sure a field always has a value when written to
I am not sure I understand the question about the field level, as the condition is field-based: https://docs.vespa.ai/documentation/reference/document-select-language.html. If you write only to one field per update and instead do more updates, it could help - but that is more load. An example will help here
Hi @kkraune, i think default value would be convenient to Vespa users. Document Proccessing may be helpful but it still complicated for dynamic usecase (add/remove/rename multi field).
Conditional updates on field level is supported. Default values is currently not. So maybe this is a feature request for having to specify default values in the schema?
Yes, like many databases, its very useful and remove complicated logic on user side.
About Conditional and set updates on field level, i mean this syntax:
{
"update": "id:customers:customers::147",
"create": true,
"fields": {
"viewtime_sum": {
"condition": "condition1",
"increment": 100
},
"view_count": {
"condition": "condition2",
"increment": 1
}
}
}
But it's ok for user do a separate update.
ok, I will change this to a feature request for default field values then - thanks for the input!