I'm trying to implement a custom index mapping (my_mapping) in Python, BUT, I do not get the expected index mapping after the python file is run!
file.py
----------
my_mapping = """
{
"settings": {
"number_of_shards": "1",
"number_of_replicas": "1"
},
"mappings": {
"properties": {
"site": {
"type": "completion",
},
"geometry": {
"type": "geo_shape"
}
}
}
}"""
result = es.index(index='my_index', document=my_mapping)
Expected Output:
{
"mappings": {
"_doc": {
"properties": {
"geometry": {
"type": "geo_shape"
},
"site": {
"type": "completion",
"analyzer": "simple",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 200
}
}
}
}
}
Actual horrible output:
{
"mappings": {
"_doc": {
"properties": {
"mappings": {
"properties": {
"properties": {
"properties": {
"geometry": { ...........
BUT! NOTE that when I instead use the following python to create the index, I DO get the expected outcome.
result = es.indices.create(index='my_index', document=my_mapping)
Can someone please explain to me the inconsistency, and HOW to generate the expected outcome USING es.index