value source config is invalid; must have either a field context or a script or marked as unwrapped

生命无罪,健康万岁,我是laity。

Seven times have I despised my soul:

For the first time, it feigned humility when it could have been aggressive;

The second time, when it was empty, fill it with lust;

The third time, between difficult and easy, it chose easy;

For the fourth time, it made a mistake, but comforted itself by saying that others would also make mistakes;

The fifth time, it is free and weak, but it is regarded as the tenacity of life;

The sixth time, when it despises an ugly face, it does not know that it is one of its own masks;

For the seventh time, it leaned sideways in the mud of life, although it was not reconciled, it was timid.

question

ElasticSearch exception:value source config is invalid; must have either a field context or a script or marked as unwrapped
insert image description here

Cause of the problem

The root cause is that there is a problem with the writing of the DSL statement.
I did not specify the termsfield

Solution

before fixing

        TermsAggregationBuilder brand_agg = AggregationBuilders.terms("eat_agg");
        brand_agg.size(50);

after modification

        TermsAggregationBuilder brand_agg = AggregationBuilders.terms("eat_agg");
        brand_agg.field("eatId").size(50);

Personal experience is for reference only~

Guess you like

Origin blog.csdn.net/duyun0/article/details/127418337