Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated url parameters _source_include and _source_exclude #35097

Merged
merged 2 commits into from
Oct 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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