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

Switch include_in_all in multifield to warning #23656

Merged
merged 1 commit into from
Mar 20, 2017
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
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,9 @@ && parseNorms(builder, name, propName, propNode, parserContext)) {
iterator.remove();
} else if (propName.equals("include_in_all")) {
if (parserContext.isWithinMultiField()) {
throw new MapperParsingException("include_in_all in multi fields is not allowed. Found the include_in_all in field ["
+ name + "] which is within a multi field.");
deprecationLogger.deprecated("include_in_all in multi fields is deprecated "
+ "because it doesn't do anything. Found the include_in_all in field "
+ "[{}] which is within a multi field.", name);
} else {
deprecationLogger.deprecated("field [include_in_all] is deprecated, as [_all] is deprecated, " +
"and will be disallowed in 6.0, use [copy_to] instead.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,11 @@ public class MultiFieldIncludeInAllMapperTests extends ESTestCase {
public void testExceptionForIncludeInAllInMultiFields() throws IOException {
XContentBuilder mapping = createMappingWithIncludeInAllInMultiField();

// first check that for newer versions we throw exception if include_in_all is found withing multi field
// first check that for newer versions we throw exception if include_in_all is found within multi field
MapperService mapperService = MapperTestUtils.newMapperService(xContentRegistry(), createTempDir(), Settings.EMPTY);
Exception e = expectThrows(MapperParsingException.class, () ->
mapperService.parse("type", new CompressedXContent(mapping.string()), true));
assertEquals("include_in_all in multi fields is not allowed. Found the include_in_all in field [c] which is within a multi field.",
e.getMessage());
mapperService.parse("type", new CompressedXContent(mapping.string()), true);
assertWarnings("include_in_all in multi fields is deprecated because it doesn't do "
+ "anything. Found the include_in_all in field [c] which is within a multi field.");
}

private static XContentBuilder createMappingWithIncludeInAllInMultiField() throws IOException {
Expand Down