Specifying id in document vs. url

Is there a way to specify the id for the document being indexed in the json
document itself? Maybe something like this:

curl -XPOST 'http://localhost:9200/es/test' -d
'{"_id":"1","user":"matt","message":"the id was given in the json
document"}'

Thanks,
Matt Weber

Also wanted to specify that I would like to do this without using the bulk
api. I am aware I can do this using the bulk api:

curl -XPOST 'http://localhost:9200/_bulk' -d '{"index": {"_index" : "es",
"_type" : "test", "_id" : "1"}}
{"user":"matt","message":"id specified in bulk"}'

Thanks,
Matt Weber

On Wed, Sep 14, 2011 at 4:07 PM, Matt Weber matt@mattweber.org wrote:

Is there a way to specify the id for the document being indexed in the json
document itself? Maybe something like this:

curl -XPOST 'http://localhost:9200/es/test' -d
'{"_id":"1","user":"matt","message":"the id was given in the json
document"}'

Thanks,
Matt Weber

You can't in 0.17, but, in master, you can by specifying a path for the id
in the mapping. This will require another (fast, pull parsing, bailing once
found) parse phase to extract the id (since it needs to be used for
routing). So, in the simple case you can specify: _id : {"path" : "_id"} in
the mapping.

On Thu, Sep 15, 2011 at 2:07 AM, Matt Weber matt@mattweber.org wrote:

Is there a way to specify the id for the document being indexed in the json
document itself? Maybe something like this:

curl -XPOST 'http://localhost:9200/es/test' -d
'{"_id":"1","user":"matt","message":"the id was given in the json
document"}'

Thanks,
Matt Weber

Awesome, thanks! Is this going to make it into 0.17.7?

Thanks,
Matt Weber

On Thu, Sep 15, 2011 at 2:33 AM, Shay Banon kimchy@gmail.com wrote:

You can't in 0.17, but, in master, you can by specifying a path for the id
in the mapping. This will require another (fast, pull parsing, bailing once
found) parse phase to extract the id (since it needs to be used for
routing). So, in the simple case you can specify: _id : {"path" : "_id"} in
the mapping.

On Thu, Sep 15, 2011 at 2:07 AM, Matt Weber matt@mattweber.org wrote:

Is there a way to specify the id for the document being indexed in the
json document itself? Maybe something like this:

curl -XPOST 'http://localhost:9200/es/test' -d
'{"_id":"1","user":"matt","message":"the id was given in the json
document"}'

Thanks,
Matt Weber

No, it will only be in master.

On Thu, Sep 15, 2011 at 6:02 PM, Matt Weber matt@mattweber.org wrote:

Awesome, thanks! Is this going to make it into 0.17.7?

Thanks,
Matt Weber

On Thu, Sep 15, 2011 at 2:33 AM, Shay Banon kimchy@gmail.com wrote:

You can't in 0.17, but, in master, you can by specifying a path for the id
in the mapping. This will require another (fast, pull parsing, bailing once
found) parse phase to extract the id (since it needs to be used for
routing). So, in the simple case you can specify: _id : {"path" : "_id"} in
the mapping.

On Thu, Sep 15, 2011 at 2:07 AM, Matt Weber matt@mattweber.org wrote:

Is there a way to specify the id for the document being indexed in the
json document itself? Maybe something like this:

curl -XPOST 'http://localhost:9200/es/test' -d
'{"_id":"1","user":"matt","message":"the id was given in the json
document"}'

Thanks,
Matt Weber

Sorry, its currently in master, will be part of 0.18 (no release date yet).

On Fri, Sep 16, 2011 at 9:47 PM, Shay Banon kimchy@gmail.com wrote:

No, it will only be in master.

On Thu, Sep 15, 2011 at 6:02 PM, Matt Weber matt@mattweber.org wrote:

Awesome, thanks! Is this going to make it into 0.17.7?

Thanks,
Matt Weber

On Thu, Sep 15, 2011 at 2:33 AM, Shay Banon kimchy@gmail.com wrote:

You can't in 0.17, but, in master, you can by specifying a path for the
id in the mapping. This will require another (fast, pull parsing, bailing
once found) parse phase to extract the id (since it needs to be used for
routing). So, in the simple case you can specify: _id : {"path" : "_id"} in
the mapping.

On Thu, Sep 15, 2011 at 2:07 AM, Matt Weber matt@mattweber.org wrote:

Is there a way to specify the id for the document being indexed in the
json document itself? Maybe something like this:

curl -XPOST 'http://localhost:9200/es/test' -d
'{"_id":"1","user":"matt","message":"the id was given in the json
document"}'

Thanks,
Matt Weber

Sounds good, thanks!

Thanks,
Matt Weber

On Fri, Sep 16, 2011 at 11:47 AM, Shay Banon kimchy@gmail.com wrote:

Sorry, its currently in master, will be part of 0.18 (no release date yet).

On Fri, Sep 16, 2011 at 9:47 PM, Shay Banon kimchy@gmail.com wrote:

No, it will only be in master.

On Thu, Sep 15, 2011 at 6:02 PM, Matt Weber matt@mattweber.org wrote:

Awesome, thanks! Is this going to make it into 0.17.7?

Thanks,
Matt Weber

On Thu, Sep 15, 2011 at 2:33 AM, Shay Banon kimchy@gmail.com wrote:

You can't in 0.17, but, in master, you can by specifying a path for the
id in the mapping. This will require another (fast, pull parsing, bailing
once found) parse phase to extract the id (since it needs to be used for
routing). So, in the simple case you can specify: _id : {"path" : "_id"} in
the mapping.

On Thu, Sep 15, 2011 at 2:07 AM, Matt Weber matt@mattweber.org wrote:

Is there a way to specify the id for the document being indexed in the
json document itself? Maybe something like this:

curl -XPOST 'http://localhost:9200/es/test' -d
'{"_id":"1","user":"matt","message":"the id was given in the json
document"}'

Thanks,
Matt Weber