With the first command, you *update* the mapping for an existing index -- 
when that index doesn't exist, you'll get, predictably, an 
error: {"error":"IndexMissingException[[twitter] missing]","status":404}

With the second, command, you're creating an index called "twitter" (hence 
PUT with name, as per RESTful conventions), while also supplying additional 
configuration (mapping) for this index.

Karel

On Thursday, January 30, 2014 11:13:33 AM UTC+1, [email protected] wrote:
>
> Hi guys and gals,
>
> I have come across a curious problem, possibly a bug while working with 
> mappings this morning. It's been a few months since I have had to create 
> any mapping but created series of PHP scripts to do so a few months ago. 
> Everything worked great until my latest upgrade to 0.90.10, now when I run 
> my scripts I get error 404 IndexMissingException. So I checked using the 
> mappings suggested in the ES documentation specifically:
>
> $ curl -XPUT 'http://localhost:9200/twitter/tweet/_mapping' -d '
> {
>     "tweet" : {
>         "properties" : {
>             "message" : {"type" : "string", "store" : "yes"}
>         }
>     }
> }
> '
>
> This throws the same error, after further investigation it seems this can be 
> used after an initial command is sent to create the index first, like:
>
> $ curl -XPUT 'http://localhost:9200/twitter/'
>
> Additionally, this can be bypassed by using the following syntax:
>
> $ curl -XPUT 'http://localhost:9200/twitter/' -d '
> {
>     "mapping" : {
>         "tweet" : {
>             "properties" : {
>                 "message" : {"type" : "string", "store" : "yes"}
>             }
>         }
>     }
> }
>
>
> I'm not sure if this is purposeful but since it is still documented on the 
> ES site I think it should be addressed or clarified.
>
> Additional I can confirm that the mapping works correctly via the Java API 
> using:
>
>
> client.admin().indices().preparePutMapping(index).setType(type).setSource(mapping).execute().actionGet();
>
> So this would suggest that the REST implementation is bugged. Any 
> feedback or clarification would be greatly appreciated.
>
> Cheers,
>
> Jon
>

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/41899e23-948d-4cc2-b216-e40bda473331%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to