Skip to content

Commit

Permalink
Sets update_all_types when setting mapping (elastic#13991)
Browse files Browse the repository at this point in the history
Prior to 5.6, we would push mappings once the object type was used. Since we are now ensuring all mappings are set, there is a situation where a field with type string exists but we are pushing text.

You can not have a field with the same name, but different data type, in two different document types.

To resolve this, we are setting update_all_types when updating mappings.

Signed-off-by: Tyler Smalley <[email protected]>
  • Loading branch information
tylersmalley authored Sep 14, 2017
1 parent cf8d97f commit d1e7b4c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core_plugins/elasticsearch/lib/ensure_types_exist.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@ export async function ensureTypesExist({ log, indexName, callCluster, types }) {
properties: {
[type.name]: type.mapping
}
}
},
update_all_types: true
});
} else {
await callCluster('indices.putMapping', {
index: indexName,
type: type.name,
body: type.mapping
body: type.mapping,
update_all_types: true
});
}
}
Expand Down

0 comments on commit d1e7b4c

Please sign in to comment.