forked from elastic/elasticsearch
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Default to not accepting type wrapper in indexing requests
Currently it is possible to index a document as: ``` POST /myindex/mytype/1 { "foo"...} ``` or as: ``` POST /myindex/mytype/1 { "mytype": { "foo"... } } ``` This makes indexing non-deterministic and fields can be misinterpreted as type names. This changes makes Elasticsearch accept only the first form by default, ie without the type wrapper. This can be changed by setting `index.mapping.allow_type_wrapper` to `true`` when creating the index. Closes elastic#4484
- Loading branch information
Showing
11 changed files
with
200 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 16 additions & 18 deletions
34
src/test/java/org/elasticsearch/index/mapper/all/test1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,18 @@ | ||
{ | ||
"person":{ | ||
"_boost":3.7, | ||
"_id":"1", | ||
"name":{ | ||
"first":"shay", | ||
"last":"banon" | ||
"_boost":3.7, | ||
"_id":"1", | ||
"name":{ | ||
"first":"shay", | ||
"last":"banon" | ||
}, | ||
"address":{ | ||
"first":{ | ||
"location":"first location" | ||
}, | ||
"address":{ | ||
"first":{ | ||
"location":"first location" | ||
}, | ||
"last":{ | ||
"location":"last location" | ||
} | ||
}, | ||
"simple1":1, | ||
"simple2":2 | ||
} | ||
} | ||
"last":{ | ||
"location":"last location" | ||
} | ||
}, | ||
"simple1":1, | ||
"simple2":2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/test/java/org/elasticsearch/index/mapper/simple/test1-withtype.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
person:{ | ||
_boost:3.7, | ||
_id:"1", | ||
name:{ | ||
first:"shay", | ||
last:"banon" | ||
}, | ||
address:{ | ||
first:{ | ||
location:"first location" | ||
}, | ||
last:{ | ||
location:"last location" | ||
} | ||
}, | ||
age:32, | ||
birthDate:"1977-11-15", | ||
nerd:true, | ||
dogs:["buck", "mia"], | ||
complex:[ | ||
{ | ||
value1:"value1" | ||
}, | ||
{ | ||
value2:"value2" | ||
} | ||
], | ||
complex2:[ | ||
[ | ||
{ | ||
value1:"value1" | ||
} | ||
], | ||
[ | ||
{ | ||
value2:"value2" | ||
} | ||
] | ||
], | ||
nullValue:null | ||
} | ||
} |
68 changes: 33 additions & 35 deletions
68
src/test/java/org/elasticsearch/index/mapper/simple/test1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,41 @@ | ||
{ | ||
person:{ | ||
_boost:3.7, | ||
_id:"1", | ||
name:{ | ||
first:"shay", | ||
last:"banon" | ||
_boost:3.7, | ||
_id:"1", | ||
name:{ | ||
first:"shay", | ||
last:"banon" | ||
}, | ||
address:{ | ||
first:{ | ||
location:"first location" | ||
}, | ||
address:{ | ||
first:{ | ||
location:"first location" | ||
}, | ||
last:{ | ||
location:"last location" | ||
} | ||
last:{ | ||
location:"last location" | ||
} | ||
}, | ||
age:32, | ||
birthDate:"1977-11-15", | ||
nerd:true, | ||
dogs:["buck", "mia"], | ||
complex:[ | ||
{ | ||
value1:"value1" | ||
}, | ||
age:32, | ||
birthDate:"1977-11-15", | ||
nerd:true, | ||
dogs:["buck", "mia"], | ||
complex:[ | ||
{ | ||
value2:"value2" | ||
} | ||
], | ||
complex2:[ | ||
[ | ||
{ | ||
value1:"value1" | ||
}, | ||
} | ||
], | ||
[ | ||
{ | ||
value2:"value2" | ||
} | ||
], | ||
complex2:[ | ||
[ | ||
{ | ||
value1:"value1" | ||
} | ||
], | ||
[ | ||
{ | ||
value2:"value2" | ||
} | ||
] | ||
], | ||
nullValue:null | ||
} | ||
} | ||
] | ||
], | ||
nullValue:null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.