|
30 | 30 | import org.elasticsearch.action.index.IndexRequest;
|
31 | 31 | import org.elasticsearch.action.update.UpdateRequest;
|
32 | 32 | import org.elasticsearch.common.Nullable;
|
33 |
| -import org.elasticsearch.common.Strings; |
34 | 33 | import org.elasticsearch.common.bytes.BytesArray;
|
35 | 34 | import org.elasticsearch.common.bytes.BytesReference;
|
36 | 35 | import org.elasticsearch.common.io.stream.StreamInput;
|
@@ -332,10 +331,16 @@ public BulkRequest add(BytesReference data, @Nullable String defaultIndex, @Null
|
332 | 331 | } else if ("_retry_on_conflict".equals(currentFieldName) || "_retryOnConflict".equals(currentFieldName)) {
|
333 | 332 | retryOnConflict = parser.intValue();
|
334 | 333 | } else if ("fields".equals(currentFieldName)) {
|
| 334 | + throw new IllegalArgumentException("Action/metadata line [" + line + "] contains a simple value for parameter [fields] while a list is expected"); |
| 335 | + } else { |
| 336 | + throw new IllegalArgumentException("Action/metadata line [" + line + "] contains an unknown parameter [" + currentFieldName + "]"); |
| 337 | + } |
| 338 | + } else if (token == XContentParser.Token.START_ARRAY) { |
| 339 | + if ("fields".equals(currentFieldName)) { |
335 | 340 | List<Object> values = parser.list();
|
336 | 341 | fields = values.toArray(new String[values.size()]);
|
337 | 342 | } else {
|
338 |
| - throw new IllegalArgumentException("Action/metadata line [" + line + "] contains an unknown parameter [" + currentFieldName + "]"); |
| 343 | + throw new IllegalArgumentException("Malformed action/metadata line [" + line + "], expected a simple value for field [" + currentFieldName + "] but found [" + token + "]"); |
339 | 344 | }
|
340 | 345 | } else if (token != XContentParser.Token.VALUE_NULL) {
|
341 | 346 | throw new IllegalArgumentException("Malformed action/metadata line [" + line + "], expected a simple value for field [" + currentFieldName + "] but found [" + token + "]");
|
|
0 commit comments