-
Notifications
You must be signed in to change notification settings - Fork 726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PutMapping api url is incorrect #102
Comments
this test fails for me:
I get:
Hopefully I'm just doing something dumb. |
Take a look at the error, it says "Invalid index name [testIndex], must be lowercase" |
sorry i was tinkering with my source to make it easy to paste. I updated the comment with the actual error message. |
(my index name is now lower case) |
here you go. full test and error message:
|
yes, the index must exist, but the test passes with the index/type/_mapping syntax and fails with the out of the box defaults. |
Your work-around also works, thanks! |
Something else is going on here, it works fine for me. If more people report an issue I'll look into it but for now, I'm stumped. # TRACE: 2014-05-19T17:50:39Z
# http://localhost:9400
curl 'http://localhost:9200/test_index?pretty=true' -XPOST
# -> 200
# {"acknowledged":true}
# INFO: 2014-05-19T17:50:39Z
# Request complete
# DEBUG: 2014-05-19T17:50:39Z
# starting request { method: 'PUT',
# path: '/test_index/_mapping/test_type',
# body: { test_type: { properties: [Object] } },
# query: {} }
#
# TRACE: 2014-05-19T17:50:39Z
# http://localhost:9400
curl 'http://localhost:9200/test_index/_mapping/test_type?pretty=true' -XPUT -d '{
"test_type": {
"properties": {
"text1": {
"type": "string",
"analyzer": "whitespace"
},
"text2": {
"type": "string",
"analyzer": "whitespace"
}
}
}
}'
# -> 200
# {"acknowledged":true} |
ok i am an idiot. i was positive i had upgraded my elasticsearch on my dev machine but apparently i had not. i am running 0.9 and changing my test to require api version 0.9 fixes the issue. sorry to have wasted your time. |
haha, oh @bleupen :P |
Hey guys. I am using ElasticSearch 1.2.1 on Windows. I wanted to create an index and set the mapping after creation. I followed the API documentation and did the following:
That actually throws the error:
So I dug into the code and replaced the line:
in /src/lib/apis/1_2.js under api.indices.prototype.putMapping with:
At least there was no error no more, but also the mapping was not applied. When I realized that this is basically the url for creating an index, I altered my code to this:
That actually created my index and set the mapping at the same time. I think my point here is that I never managed to run the putMapping() function successfully. |
@Amberlamps Check out the body from the first example here: http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/indices-put-mapping.html#indices-put-mapping The mapping needs to be wrapped in the type name, "properties", and then the hash of mappings. Your example modified: client.create({ index: 'blog', type: 'post' }, function(err, body, code) {
var body = { post: { properties: { title: { type: 'string' }}}};
client.indices.putMapping({ index: 'blog', type: 'post', body: body }, function(err, body, code) {
if (err) throw new Error(err);
});
}); |
it's currently "/<%=index%>/_mapping/<%=type%>"
should this be changed to "/<%=index%>/<%=type%>/_mapping"?
The text was updated successfully, but these errors were encountered: