Hmmm interesting looks like ignore_malformed
in the destination worked for me... perhaps the dynamic part?
DELETE my-index-000001
PUT my-index-000001
{
"mappings": {
"properties": {
"number_one": {
"type": "integer",
"ignore_malformed": true
},
"number_two": {
"type": "integer"
}
}
}
}
POST my-index-000001/_doc/
{
"text": "Some text value",
"number_one": "foo",
"number_two": 3
}
POST my-index-000001/_doc/
{
"text": "Some text value",
"number_one": 1,
"number_two": 3
}
POST my-index-000001/_doc/
{
"text": "Some text value",
"number_one": 2,
"number_two": 3
}
POST my-index-000001/_doc/
{
"text": "Some text value",
"number_one": "bar",
"number_two": 3
}
GET my-index-000001/_search
{
"fields": [
"*"
]
}
PUT my-index-dest
{
"mappings": {
"properties": {
"number_one": {
"type": "integer",
"ignore_malformed": true
},
"number_two": {
"type": "integer"
}
}
}
}
POST _reindex
{
"source": {"index" : "my-index-000001"},
"dest": {"index": "my-index-dest"}
}
# Results
{
"took": 21,
"timed_out": false,
"total": 4,
"updated": 0,
"created": 4,
"deleted": 0,
"batches": 1,
"version_conflicts": 0,
"noops": 0,
"retries": {
"bulk": 0,
"search": 0
},
"throttled_millis": 0,
"requests_per_second": -1,
"throttled_until_millis": 0,
"failures": []
}
GET my-index-dest/_search
{
"fields": [
"*"
]
}
# Results
{
"took": 0,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 4,
"relation": "eq"
},
"max_score": 1,
"hits": [
{
"_index": "my-index-dest",
"_id": "MiuzuIYBTddQNYvBZZqp",
"_score": 1,
"_ignored": [
"number_one"
],
"_source": {
"text": "Some text value",
"number_one": "foo",
"number_two": 3
},
"fields": {
"number_two": [
3
],
"text.keyword": [
"Some text value"
],
"text": [
"Some text value"
]
},
"ignored_field_values": {
"number_one": [
"foo"
]
}
},
{
"_index": "my-index-dest",
"_id": "MyuzuIYBTddQNYvBZZrT",
"_score": 1,
"_source": {
"text": "Some text value",
"number_one": 1,
"number_two": 3
},
"fields": {
"number_two": [
3
],
"number_one": [
1
],
"text.keyword": [
"Some text value"
],
"text": [
"Some text value"
]
}
},
{
"_index": "my-index-dest",
"_id": "NCuzuIYBTddQNYvBZZrh",
"_score": 1,
"_source": {
"text": "Some text value",
"number_one": 2,
"number_two": 3
},
"fields": {
"number_two": [
3
],
"number_one": [
2
],
"text.keyword": [
"Some text value"
],
"text": [
"Some text value"
]
}
},
{
"_index": "my-index-dest",
"_id": "NSuzuIYBTddQNYvBZZru",
"_score": 1,
"_ignored": [
"number_one"
],
"_source": {
"text": "Some text value",
"number_one": "bar",
"number_two": 3
},
"fields": {
"number_two": [
3
],
"text.keyword": [
"Some text value"
],
"text": [
"Some text value"
]
},
"ignored_field_values": {
"number_one": [
"bar"
]
}
}
]
}
}