Skip to content

Commit 9968928

Browse files
authored
Remove support for deprecated force_source highlighting parameter (#116943)
force_source is being parsed as a no-op since 8.8. This commit removes support for it at REST, meaning a search request that provides it gets now an error back.
1 parent cc35f1d commit 9968928

File tree

4 files changed

+11
-21
lines changed

4 files changed

+11
-21
lines changed

docs/changelog/116943.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
pr: 116943
2+
summary: Remove support for deprecated `force_source` highlighting parameter
3+
area: Highlighting
4+
type: breaking
5+
issues: []
6+
breaking:
7+
title: Remove support for deprecated `force_source` highlighting parameter
8+
area: REST API
9+
details: The deprecated highlighting `force_source` parameter is no longer supported.
10+
impact: Users should remove usages of the `force_source` parameter from their search requests.
11+
notable: false

docs/reference/search/search-your-data/highlighting.asciidoc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,6 @@ fragmenter:: Specifies how text should be broken up in highlight
176176
snippets: `simple` or `span`. Only valid for the `plain` highlighter.
177177
Defaults to `span`.
178178

179-
force_source:: deprecated; this parameter has no effect
180-
181179
`simple`::: Breaks up text into same-sized fragments.
182180
`span`::: Breaks up text into same-sized fragments, but tries to avoid
183181
breaking up text between highlighted terms. This is helpful when you're

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ public abstract class AbstractHighlighterBuilder<HB extends AbstractHighlighterB
6464
public static final ParseField TYPE_FIELD = new ParseField("type");
6565
public static final ParseField FRAGMENTER_FIELD = new ParseField("fragmenter");
6666
public static final ParseField NO_MATCH_SIZE_FIELD = new ParseField("no_match_size");
67-
public static final ParseField FORCE_SOURCE_FIELD = new ParseField("force_source").withAllDeprecated();
6867
public static final ParseField PHRASE_LIMIT_FIELD = new ParseField("phrase_limit");
6968
public static final ParseField OPTIONS_FIELD = new ParseField("options");
7069
public static final ParseField HIGHLIGHT_QUERY_FIELD = new ParseField("highlight_query");
@@ -152,9 +151,6 @@ protected AbstractHighlighterBuilder(StreamInput in) throws IOException {
152151
}
153152
order(in.readOptionalWriteable(Order::readFromStream));
154153
highlightFilter(in.readOptionalBoolean());
155-
if (in.getTransportVersion().before(TransportVersions.V_8_8_0)) {
156-
in.readOptionalBoolean(); // force_source, now deprecated
157-
}
158154
boundaryScannerType(in.readOptionalWriteable(BoundaryScannerType::readFromStream));
159155
boundaryMaxScan(in.readOptionalVInt());
160156
if (in.readBoolean()) {
@@ -193,9 +189,6 @@ public final void writeTo(StreamOutput out) throws IOException {
193189
}
194190
out.writeOptionalWriteable(order);
195191
out.writeOptionalBoolean(highlightFilter);
196-
if (out.getTransportVersion().before(TransportVersions.V_8_8_0)) {
197-
out.writeOptionalBoolean(false);
198-
}
199192
out.writeOptionalWriteable(boundaryScannerType);
200193
out.writeOptionalVInt(boundaryMaxScan);
201194
boolean hasBounaryChars = boundaryChars != null;
@@ -674,7 +667,6 @@ static <HB extends AbstractHighlighterBuilder<HB>> BiFunction<XContentParser, HB
674667
parser.declareString(HB::highlighterType, TYPE_FIELD);
675668
parser.declareString(HB::fragmenter, FRAGMENTER_FIELD);
676669
parser.declareInt(HB::noMatchSize, NO_MATCH_SIZE_FIELD);
677-
parser.declareBoolean((builder, value) -> {}, FORCE_SOURCE_FIELD); // force_source is ignored
678670
parser.declareInt(HB::phraseLimit, PHRASE_LIMIT_FIELD);
679671
parser.declareInt(HB::maxAnalyzedOffset, MAX_ANALYZED_OFFSET_FIELD);
680672
parser.declareObject(HB::options, (XContentParser p, Void c) -> {

server/src/test/java/org/elasticsearch/search/fetch/subphase/highlight/HighlightBuilderTests.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -607,17 +607,6 @@ public void testOrderSerialization() throws Exception {
607607
}
608608
}
609609

610-
public void testForceSourceDeprecation() throws IOException {
611-
String highlightJson = """
612-
{ "fields" : { }, "force_source" : true }
613-
""";
614-
try (XContentParser parser = createParser(JsonXContent.jsonXContent, highlightJson)) {
615-
HighlightBuilder.fromXContent(parser);
616-
}
617-
618-
assertWarnings("Deprecated field [force_source] used, this field is unused and will be removed entirely");
619-
}
620-
621610
protected static XContentBuilder toXContent(HighlightBuilder highlight, XContentType contentType) throws IOException {
622611
XContentBuilder builder = XContentFactory.contentBuilder(contentType);
623612
if (randomBoolean()) {

0 commit comments

Comments
 (0)