Britta Weber 8076a31ac1 Throw exception if an additional field was placed inside the "query" body
Currently the parser accepts queries like

```
"query" : {
     "any_query": {
         ...
     },
     "any_field_name":...
}
```

The "any_field_name" is silently ignored. However, this also causes the parser
not to move to the next closing bracket which in turn can lead to additional query
paremters being ignored such as "fields", "highlight",...
This was the case in issue #4895

closes issue #4895
2014-04-25 08:57:06 +02:00

37 lines
627 B
YAML

---
setup:
- do:
indices.create:
index: test
- do:
index:
index: test
type: test
id: 1
body:
user : foo
amount : 35
data : some
- do:
indices.refresh:
index: [test]
---
"Test with _local preference placed in query body - should fail":
- do:
catch: request
search:
index: test
type: test
body:
query:
term:
data: some
preference: _local
fields: [user,amount]