Created
February 1, 2012 14:22
-
-
Save Alex-Ikanow/1717268 to your computer and use it in GitHub Desktop.
GIST failing to demonstrate lack of robustness on type conflicts
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
// Unfortunately this attempt at a simple recreation doesn't work. | |
// This differences vs the real world case (that occurs 100% consistently are): | |
// - the "obj1" equivalent is not a completely dynamic object, all fields are declared via mapping apart from obj2 | |
// - the "obj1" mapping has a long and complex set of dynamic templates declared (none of which are used) | |
// - many other documents not containing any obj2 fields have been indexed before the first value with a "bad" obj2 is indexed | |
// (- several GBs of other shards/indexes etc etc are present) | |
// 1] Create an index, eg something like | |
curl -XPUT 'http://localhost:9200/type_mismatch_test/' | |
// 2] Insert some object2 with a "{}" field nested a couple of layers down | |
curl -XPOST 'http://localhost:9200/type_mismatch_test/test/' -d '{"obj1":{"name":"blue","obj2": { "obj3": [{ type:"object", value:{} }] }}}' | |
curl -XPOST 'http://localhost:9200/type_mismatch_test/test/' -d '{"obj1":{"name":"green","obj2": { "obj3": [{ type:"object", value:{} }] }}}' | |
curl -XPOST 'http://localhost:9200/type_mismatch_test/test/' -d '{"obj1":{"name":"ortange","obj2": { "obj3": [{ type:"object", value:{} }] }}}' | |
//(the index metadata correctly indicates obj1.value is of type object) | |
// 3] Insert an object with a string field | |
curl -XPOST 'http://localhost:9200/type_mismatch_test/test/' -d '{"obj1":{"name":"red","obj2": { "obj3": [{ type:"string", value:"fail?" }] }}}' | |
// This (in the real world) causes the input thread to go into a tight loop from which it never recovers | |
// (ie the above curl hangs, one of the CPUs goes to 100%) | |
// Unfortunately in this GIST I correctly get the error: | |
// MapperParsingException[object mapping for [obj3] tried to parse as object, but got EOF, has a concrete value been provided to it?] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment