vespa icon indicating copy to clipboard operation
vespa copied to clipboard

[Feature Request] Default value for fields

Open brucemen opened this issue 5 years ago • 6 comments

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.

brucemen avatar Oct 25 '20 15:10 brucemen

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

kkraune avatar Oct 26 '20 08:10 kkraune

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).

brucemen avatar Oct 26 '20 16:10 brucemen

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?

jobergum avatar Oct 27 '20 08:10 jobergum

Yes, like many databases, its very useful and remove complicated logic on user side.

brucemen avatar Oct 28 '20 13:10 brucemen

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.

brucemen avatar Oct 28 '20 13:10 brucemen

ok, I will change this to a feature request for default field values then - thanks for the input!

kkraune avatar Oct 29 '20 10:10 kkraune