Issue 1:
The idea behind ignore_malformed setting, is to ensure all records being added get added to the index, even if some of the JSON attribute use an invalid data type (compared to the index's expected mapping). This is particularly useful with dynamic JSON document, where it's most important that all objects are "added" (rather than rejected via exception).

However, there are some cases where malformed JSON object are being reject (exception) instead of getting accepted. Repro steps:

Make sure the ignore_malformed setting is enabled

Add a first record

~$ curl -XPUT 'http://127.0.0.1:9200/tweets/tweet/123' -d '{ "value" : 12345 }'
{"_index":"tweets","_type":"tweet","_id":"123","_version":1,"created":true}~ $

The index now expected a long value for the "value" field.

Add a malformed record

~ $ curl -XPUT 'http://127.0.0.1:9200/tweets/tweet/124' -d '{ "value" : "Hello" }'
{"_index":"tweets","_type":"tweet","_id":"124","_version":1,"created":true}

The malformed record is accepted, as expected.

Add another malformed record

~ $ curl -XPUT 'http://127.0.0.1:9200/tweets/tweet/125' -d '{ "value" : 123123123123123123123 }'
{"error":"MapperParsingException[failed to parse [value]]; nested: JsonParseException[Numeric value (123123123123123123123) out of range of long (-9223372036854775808 - 9223372036854775807)\n at [Source: [B@52259927; line: 1, column: 34]]; ","status":400}

Expected: This malformed record should still be added, with the 123123123123123123123 value coerced into a string.

Issue 2:
using elasticsearch 1.5.2 I can index values greater than 127 for a byte field without getting any error. The values just overflow internally and the resulting numbers can be searched for.

e.g. indexing 250 ends up as -6

indexing 260 ends up as 4

curl -XPUT localhost:9200/test -d '
{
"mappings" : {
"foo" : {
"properties" : {
"field1" : { "type" : "byte" }
}
}
}
}'

curl -XPUT localhost:9200/test/foo/one -d '
{
"field1" : 127
}'

curl -XPUT localhost:9200/test/foo/two -d '
{
"field1" : 250
}'

curl -XPUT localhost:9200/test/foo/three -d '
{
"field1" : 260
}'

now searching like this...

curl -XGET localhost:9200/test/_search?search_type=count -d '
{
"aggs" : {
"values" : {
"terms" : { "field" : "field1" }
}
}
}'

returns the following resultset

{
"took": 3,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 3,
"max_score": 0,
"hits": []
},
"aggregations": {
"values": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": -6,
"doc_count": 1
},
{
"key": 4,
"doc_count": 1
},
{
"key": 127,
"doc_count": 1
}
]
}
}
}

trying the same with a 'short' number, you get an error message for document 'two'

curl -XPUT localhost:9200/test -d '
{
"mappings" : {
"foo" : {
"properties" : {
"field1" : { "type" : "short" }
}
}
}
}'

curl -XPUT localhost:9200/test/foo/one -d '
{
"field1" : 31000
}'

curl -XPUT localhost:9200/test/foo/two -d '
{
"field1" : 33000
}'

{
"error": "RemoteTransportException[[dev-test-mon-es-02][inet[/192.168.110.83:9300]][indices:data/write/index]]; nested: MapperParsingException[failed to parse [field1]]; nested: JsonParseException[Numeric value (33000) out of range of Java short\n at [Source: UNKNOWN; line: 2, column: 19]]; ",
"status": 400
}