1

In Elastic Search, to add new fields while running the application we have to provide

"dynamic":true

More info about the same: https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic.html

Is there any functionality which can replicate same behaviour in Vespa? I was not able to find in vespa documentation. Kindly help me in this regard. Thank you.

2 Answers2

1

https://docs.vespa.ai/en/schemas.html#schema-modifications is the best place to start - just modify the schema with new fields and redeploy the application. The new fields can not have a default value, they are empty. It is not necessary to restart Vespa, this can be done on a running instance.

Kristian Aune
  • 876
  • 5
  • 5
  • But, the time when vespa is redeploying, application will go down. Is there any way we can update schema without effecting the application? – Yashodhara Shastri Mar 22 '22 at 07:21
  • Vespa will not go down when redeploying - both query and document API interfaces are always up, also during deploy. If it goes down, something is wrong, please use https://vespa.ai/support if so. – Kristian Aune Mar 22 '22 at 12:31
1

Dynamic fields automatically created from data is not supported in Vespa. You should not use this; it's a malfeature.

If the data in question is structured, you can often achieve what you need here by using a map. Otherwise, it's easy and safe to add new fields to the schema and redeploy.

Jon
  • 2,043
  • 11
  • 9
  • We want to allow customer to add new field of their choice keeping basic fields common. Redeploying for each changes wont be efficient enough. – Yashodhara Shastri Mar 14 '22 at 12:16
  • In any case it is not a good idea for end users to control the config of a shared resource directly, so yes you shouldn't let users add fields unless you are creating a truly multitenant cloud service similar to Vespa Cloud. Dynamic fields have the same problem. The usual solution here is to add a number of generic fields to the schema along with some logic (in a Searcher and Document Processor) that translates to/from a user-defined name for fields they add. Then you can support dynamic fields while remaining in control of the resources used by fields. – Jon Mar 14 '22 at 21:52