Skip to content

Commit a004a33

Browse files
author
Christoph Büscher
authored
Prevent accidental changes of default values (#29528)
The default percentiles values and the default highlighter per- and post-tags are currently publicly accessible and can be altered any time. This change prevents this by restricting field access.
1 parent 7931cf8 commit a004a33

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

server/src/main/java/org/elasticsearch/search/aggregations/metrics/percentiles/PercentilesAggregationBuilder.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import org.elasticsearch.common.xcontent.XContentBuilder;
2727
import org.elasticsearch.common.xcontent.XContentParser;
2828
import org.elasticsearch.search.aggregations.AggregationBuilder;
29-
import org.elasticsearch.search.aggregations.AggregatorFactories;
3029
import org.elasticsearch.search.aggregations.AggregatorFactories.Builder;
3130
import org.elasticsearch.search.aggregations.AggregatorFactory;
3231
import org.elasticsearch.search.aggregations.metrics.percentiles.hdr.HDRPercentilesAggregatorFactory;
@@ -50,7 +49,7 @@
5049
public class PercentilesAggregationBuilder extends LeafOnly<ValuesSource.Numeric, PercentilesAggregationBuilder> {
5150
public static final String NAME = Percentiles.TYPE_NAME;
5251

53-
public static final double[] DEFAULT_PERCENTS = new double[] { 1, 5, 25, 50, 75, 95, 99 };
52+
private static final double[] DEFAULT_PERCENTS = new double[] { 1, 5, 25, 50, 75, 95, 99 };
5453
public static final ParseField PERCENTS_FIELD = new ParseField("percents");
5554
public static final ParseField KEYED_FIELD = new ParseField("keyed");
5655
public static final ParseField METHOD_FIELD = new ParseField("method");

server/src/main/java/org/elasticsearch/search/fetch/subphase/highlight/HighlightBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ public class HighlightBuilder extends AbstractHighlighterBuilder<HighlightBuilde
7575
/** the default number of fragments size in characters */
7676
public static final int DEFAULT_FRAGMENT_CHAR_SIZE = 100;
7777
/** the default opening tag */
78-
public static final String[] DEFAULT_PRE_TAGS = new String[]{"<em>"};
78+
static final String[] DEFAULT_PRE_TAGS = new String[]{"<em>"};
7979
/** the default closing tag */
80-
public static final String[] DEFAULT_POST_TAGS = new String[]{"</em>"};
80+
static final String[] DEFAULT_POST_TAGS = new String[]{"</em>"};
8181

8282
/** the default opening tags when <tt>tag_schema = "styled"</tt> */
8383
public static final String[] DEFAULT_STYLED_PRE_TAG = {

0 commit comments

Comments
 (0)