Using a combined field as id mapping in ElasticSearch


(vinamar) #1

I'm using ES 0.90.7.

Is there a way to do _id mapped to a custom value which is based on more than one field?

Like i want _id to combine srId and closeDt as our document key?

this one doesnt work.

{
"mappings": {
"json": {
"_id": {
"path": "srId.closeDt",
"properties": {
"srId": {
"index": "not_analyzed",
"type": "string"
},
"closeDt": {
"index": "not_analyzed",
"type": "long"
}
}
}
}
}
}'


(David Pilato) #2

You should do that on a client level and add a new attribute in your doc or send the right _id.

My 2 cents.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 16 janv. 2014 à 20:52, vinamar vinamar@gmail.com a écrit :

I'm using ES 0.90.7.

Is there a way to do _id mapped to a custom value which is based on more
than one field?
http://stackoverflow.com/questions/21041952/using-a-combined-field-as-id-mapping-in-elasticsearch

Like i want _id to combine srId and closeDt as our document key?

this one doesnt work.

{
"mappings": {
"json": {
"_id": {
"path": "srId.closeDt",
"properties": {
"srId": {
"index": "not_analyzed",
"type": "string"
},
"closeDt": {
"index": "not_analyzed",
"type": "long"
}
}
}
}
}
}'

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/Using-a-combined-field-as-id-mapping-in-ElasticSearch-tp4047728.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1389901947442-4047728.post%40n3.nabble.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/22CD0FFA-DDF2-4D73-B96A-6AD75CA15CCF%40pilato.fr.
For more options, visit https://groups.google.com/groups/opt_out.


(vinamar) #3

Hi David,

I'm using fsriver plugin. Is there a way to specify a script to generate a field like how couchDB river plugin is able to do.

{
"couchdoc" : {
"_id" : {
"path" : "doc_rev_id"
}
}
}
{
"type" : "couchdb",
"couchdb" : {
"script" : "ctx.doc.doc_rev_id = ctx.doc.id + '' + ctx.doc._rev"
}
}


(David Pilato) #4

No. Scripts are not supported in fsriver. What do you want to add with scripts?

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 16 janv. 2014 à 23:56, vinamar vinamar@gmail.com a écrit :

Hi David,

I'm using fsriver plugin. Is there a way to specify a script to generate a
field like how couchDB river plugin is able to do.

http://stackoverflow.com/questions/15421720/how-do-i-index-all-the-revisions-of-a-couchdb-doc-using-elasticsearch-river-plug

{
"couchdoc" : {
"_id" : {
"path" : "doc_rev_id"
}
}
}
{
"type" : "couchdb",
"couchdb" : {
"script" : "ctx.doc.doc_rev_id = ctx.doc.id + '' + ctx.doc._rev"
}
}

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/Using-a-combined-field-as-id-mapping-in-ElasticSearch-tp4047728p4047738.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1389912978917-4047738.post%40n3.nabble.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/68BBAFDD-7AD7-47CD-BB9F-1B77886EC10F%40pilato.fr.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #5