Skip to content

Commit

Permalink
Remove deprecated url parameters _source_include and `_source_exclu…
Browse files Browse the repository at this point in the history
…de` (#35097)

Removes `_source_include` and `_source_exclude` url parameters. 
These parameters have been deprecated in #33475.

Closes #22792
  • Loading branch information
lipsill authored and nik9000 committed Oct 31, 2018
1 parent f87a534 commit d181d1b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 48 deletions.
5 changes: 5 additions & 0 deletions docs/reference/migration/migrate_7_0/api.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,8 @@ status 200 - OK is now returned instead at all times.
The Put User API response was changed in 6.5.0 to add the `created` field
outside of the user object where it previously had been. In 7.0.0 the user
object has been removed in favor of the top level `created` field.

[float]
==== Source filtering url parameters `_source_include` and `_source_exclude` have been removed

The deprecated in 6.x url parameters are now removed. Use `_source_includes` and `_source_excludes` instead.
Original file line number Diff line number Diff line change
Expand Up @@ -70,37 +70,3 @@
- match: { _id: "1" }
- match: { fields.count: [1] }
- match: { _source.include.field1: v1 }

---
"Deprecated _source_include and _source_exclude":

- skip:
version: " - 6.5.99"
reason: _source_include and _source_exclude are deprecated from 6.6.0
features: "warnings"

- do:
indices.create:
index: test_1
body:
mappings:
_doc:
properties:
count:
type: integer
store: true

- do:
index:
index: test_1
type: _doc
id: 1
body: { "include": { "field1": "v1", "field2": "v2" }, "count": 1 }
- do:
get: { index: test_1, type: _doc, id: 1, _source_include: include.field1 }
warnings:
- "Deprecated parameter [_source_include] used, expected [_source_includes] instead"
- do:
get: { index: test_1, type: _doc, id: 1, _source_includes: include, _source_exclude: "*.field2" }
warnings:
- "Deprecated parameter [_source_exclude] used, expected [_source_excludes] instead"
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@

package org.elasticsearch.search.fetch.subphase;

import org.apache.logging.log4j.LogManager;
import org.elasticsearch.common.Booleans;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.xcontent.ToXContentObject;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
Expand All @@ -46,8 +44,6 @@
*/
public class FetchSourceContext implements Writeable, ToXContentObject {

private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(LogManager.getLogger(FetchSourceContext.class));

public static final ParseField INCLUDES_FIELD = new ParseField("includes", "include");
public static final ParseField EXCLUDES_FIELD = new ParseField("excludes", "exclude");

Expand Down Expand Up @@ -110,21 +106,11 @@ public static FetchSourceContext parseFromRestRequest(RestRequest request) {
}

String sIncludes = request.param("_source_includes");
String sInclude = request.param("_source_include");
if (sInclude != null) {
DEPRECATION_LOGGER.deprecated("Deprecated parameter [_source_include] used, expected [_source_includes] instead");
sIncludes = sInclude;
}
if (sIncludes != null) {
sourceIncludes = Strings.splitStringByCommaToArray(sIncludes);
}

String sExcludes = request.param("_source_excludes");
String sExclude = request.param("_source_exclude");
if (sExclude != null) {
DEPRECATION_LOGGER.deprecated("Deprecated parameter [_source_exclude] used, expected [_source_excludes] instead");
sExcludes = sExclude;
}
if (sExcludes != null) {
sourceExcludes = Strings.splitStringByCommaToArray(sExcludes);
}
Expand Down

0 comments on commit d181d1b

Please sign in to comment.