|
8 | 8 |
|
9 | 9 | package org.elasticsearch.xcontent;
|
10 | 10 |
|
| 11 | +import org.elasticsearch.core.CheckedFunction; |
| 12 | + |
11 | 13 | import java.io.IOException;
|
12 | 14 | import java.util.ArrayDeque;
|
13 | 15 | import java.util.Deque;
|
| 16 | +import java.util.List; |
| 17 | +import java.util.Map; |
| 18 | +import java.util.function.Supplier; |
14 | 19 |
|
15 | 20 | /**
|
16 | 21 | * An XContentParser that reinterprets field names containing dots as an object structure.
|
17 | 22 | *
|
18 | 23 | * A field name named {@code "foo.bar.baz":...} will be parsed instead as {@code 'foo':{'bar':{'baz':...}}}.
|
19 | 24 | * The token location is preserved so that error messages refer to the original content being parsed.
|
| 25 | + * This parser can output duplicate keys, but that is fine given that it's used for document parsing. The mapping |
| 26 | + * lookups will return the same mapper/field type, and we never load incoming documents in a map where duplicate |
| 27 | + * keys would end up overriding each other. |
20 | 28 | */
|
21 | 29 | public class DotExpandingXContentParser extends FilterXContentParserWrapper {
|
22 | 30 |
|
@@ -75,6 +83,37 @@ private void expandDots() throws IOException {
|
75 | 83 | protected XContentParser delegate() {
|
76 | 84 | return parsers.peek();
|
77 | 85 | }
|
| 86 | + |
| 87 | + @Override |
| 88 | + public Map<String, Object> map() throws IOException { |
| 89 | + throw new UnsupportedOperationException(); |
| 90 | + } |
| 91 | + |
| 92 | + @Override |
| 93 | + public Map<String, Object> mapOrdered() throws IOException { |
| 94 | + throw new UnsupportedOperationException(); |
| 95 | + } |
| 96 | + |
| 97 | + @Override |
| 98 | + public Map<String, String> mapStrings() throws IOException { |
| 99 | + throw new UnsupportedOperationException(); |
| 100 | + } |
| 101 | + |
| 102 | + @Override |
| 103 | + public <T> Map<String, T> map(Supplier<Map<String, T>> mapFactory, CheckedFunction<XContentParser, T, IOException> mapValueParser) |
| 104 | + throws IOException { |
| 105 | + throw new UnsupportedOperationException(); |
| 106 | + } |
| 107 | + |
| 108 | + @Override |
| 109 | + public List<Object> list() throws IOException { |
| 110 | + throw new UnsupportedOperationException(); |
| 111 | + } |
| 112 | + |
| 113 | + @Override |
| 114 | + public List<Object> listOrderedMap() throws IOException { |
| 115 | + throw new UnsupportedOperationException(); |
| 116 | + } |
78 | 117 | }
|
79 | 118 |
|
80 | 119 | private static String[] splitAndValidatePath(String fullFieldPath) {
|
|
0 commit comments