I try to create an type-ahead functionality based on Elasticsearch. But I cannot create documents as said in documentation https://www.elastic.co/guide/en/elasticsearch/reference/5.6/search-suggesters-completion.html#completion-suggester-mapping
Here is my dump:
This is my template
PUT /_template/infinity-index
{
"template": "infinity-index-*",
"settings": {},
"mappings": {
"*": {
"properties": {
"id": {
"type": "integer"
},
"status": {
"type": "keyword",
"index": true
},
"manufacturer": {
"type": "text",
"index": true
},
"suggest": {
"type": "completion"
}
}
}
}
}
Then I send bulk request (here is only one document):
POST _bulk
{"create":{"_id":"60003","_index":"infinity-index-2018-01-13","_type":"default"}}
{"id":60003,"status":"active","manufacturer":"WMV","suggest":[{"input": "WVM", "weight": 0}]}
and I get this error:
{
"took": 64,
"errors": true,
"items": [
{
"create": {
"_index": "infinity-index-2018-01-13",
"_type": "default",
"_id": "60003",
"status": 400,
"error": {
"type": "illegal_argument_exception",
"reason": "[suggest] is defined as an object in mapping [default] but this name is already used for a field in other types"
}
}
}
]
}
Can anybody give me a hint, what I did wrong? Thanks
["WVM"], after that all other documents and the first document can have object value:[{"input": "WVM", "weight": 0}]- Serghei Luchianenco