There are two ways:
1> define a dynamic field pattern, i.e.

<dynamicField name="*_sum" type="float" ...../>

Now just add any field in the doc you want. If it ends in "_sum" and
no other explicit field matches you have a new field.

2> Use the managed schema to add these on the fly. I don't recommend
this from what I know of your use case, this is primarily intended for
front-ends to be able to modify the schema and/or "field guessing".

I do caution you though that either way don't go over-the-top. If
you're thinking of thousands of different fields that can lead to
performance issues.

You can either put stuff in the field on your indexing client or
create a custom update component, perhaps the simplest would be a
"StatelessScriptUpdateProcessorFactory:

see: 
https://cwiki.apache.org/confluence/display/solr/Update+Request+Processors#UpdateRequestProcessors-UpdateRequestProcessorFactories

Best,
Erick

On Mon, Jul 3, 2017 at 10:52 AM, Pablo Anzorena <anzorena.f...@gmail.com> wrote:
> Hey,
>
> I was wondering if there is some way to add fields "on the fly" based on
> arithmetic operations on other fields. For example add a new field
> "custom_field" = log(field1) + field2 -5.
>
> Thanks.

Reply via email to