JoeeGrigg
(Joe Grigg)
August 26, 2015, 2:07pm
1
I have been trying to set up default mappings for a brand new index and I keep getting errors.
This is what I am doing
PUT /documents
{
mappings": {
"_default_: {
"title": {"type": "string"},
"author": {"type": "string"},
"description": {"type": "string"},
"tags": {"type": "string"},
"country": {"type": "string"},
"version": {"type": "double"},
"revisions": {"type": "string"},
"createdAt": {"type": "date"},
"updatedAt": {"type": "date"},
"fileType": {"type": "string"},
"urlToFile": {"type": "string"},
"archived": {"type": "boolean"},
"archivedDate": {"type": "date"},
"archivedReason": {"type": "string"}
}
}
}
And then the error that I am getting is:
{"error":"ElasticsearchParseException[failed to parse source for create index]; nested: JsonParseException[Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in name\n at [Source: [B@75dfe5d5; line: 3, column: 17]]; ","status":400}
Does anyone have any ideas?
colings86
(Colin Goodheart-Smithe)
August 26, 2015, 2:09pm
2
You are missing a "
character after _default
:
JoeeGrigg:
"default : {
colings86
(Colin Goodheart-Smithe)
August 26, 2015, 2:12pm
3
You are also missing a "
before mappings
:
JoeeGrigg:
mappings": {
JoeeGrigg
(Joe Grigg)
August 26, 2015, 2:12pm
4
Ah yeah that was silly.
However I have fixed that and still not having any luck.
I am still getting the same error
JoeeGrigg
(Joe Grigg)
August 26, 2015, 2:15pm
5
Never mind. But I do have a different error now
{"error":"MapperParsingException[mapping [_default_]]; nested: MapperParsingException[Root type mapping not empty after parsing! Remaining fields: [archivedDate : {type=date}] [country : {type=string}] [urlToFile : {type=string}] [author : {type=string}] [description : {type=string}] [title : {type=string}] [version : {type=double}] [tags : {type=string}] [createdAt : {type=date}] [archived : {type=boolean}] [revisions : {type=string}] [fileType : {type=string}] [archivedReason : {type=string}] [updatedAt : {type=date}]]; ","status":400}
Any ideas on this one? @colings86
colings86
(Colin Goodheart-Smithe)
August 26, 2015, 2:17pm
6
You need to have a "properties":{}
object under _default_
and put your fields in there. see https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-core-types.html for more information on setting mappings
1 Like