Couchdb river can't know to insert parent param

I query parent child like this

Mapping

curl -XPOST "http://localhost:9200/new_index" -d '{
"mappings": {
"record": {
"properties": {
"num": {
"type": "long"
}
}
},
"field": {
"_parent": {
"type": "record"
},
"properties": {
"content": {
"type": "string",
"index": "not_analyzed",
"store": "yes"
}
}
}
}
}'

Index data

curl -XPUT 'http://localhost:9200/new_type/record/1' -d '{ //
Please notice id=1
"num" : "frank"
}'
curl -XPUT 'http://localhost:9200/submissions/field/1?parent=1' -d
'{ // Please notice insert parent param =1
"content" : "noodles",
"mnemonic" : "ndl"
}'
curl -XPUT 'http://localhost:9200/submissions/field/2?parent=1' -d
'{ // Please notice insert parent param =1
"content" : "fish",
"mnemonic" : "fsh"
}'

I use the couchdb river to automatic tranfer data from database to
Elasticsearch index. I got problem when must insert parent param ( I
noticed above). How can I config the river to insert parent param.
Maybe I think config in this script. Help me please.
curl -XPUT 'http://localhost:9200/_river/animal/_meta' -d '{
"type" : "couchdb",
"couchdb" : {
"host" : "localhost",
"port" : 5984,
"db" : "my_couch_db",
"filter" : "Field/fieldfilters",
},
"index" : {
"index" : "new_index",
"type" : "field",
"bulk_size" : "1000",
"bulk_timeout" : "10ms"
}
}'

Yea, you can use a script and update ctx._parent field.

On Fri, Mar 16, 2012 at 1:05 PM, inlier hiquocthang@gmail.com wrote:

I query parent child like this

Mapping

curl -XPOST "http://localhost:9200/new_index" -d '{
"mappings": {
"record": {
"properties": {
"num": {
"type": "long"
}
}
},
"field": {
"_parent": {
"type": "record"
},
"properties": {
"content": {
"type": "string",
"index": "not_analyzed",
"store": "yes"
}
}
}
}
}'

Index data

curl -XPUT 'http://localhost:9200/new_type/record/1' -d '{ //
Please notice id=1
"num" : "frank"
}'
curl -XPUT 'http://localhost:9200/submissions/field/1?parent=1' -d
'{ // Please notice insert parent param =1
"content" : "noodles",
"mnemonic" : "ndl"
}'
curl -XPUT 'http://localhost:9200/submissions/field/2?parent=1' -d
'{ // Please notice insert parent param =1
"content" : "fish",
"mnemonic" : "fsh"
}'

I use the couchdb river to automatic tranfer data from database to
Elasticsearch index. I got problem when must insert parent param ( I
noticed above). How can I config the river to insert parent param.
Maybe I think config in this script. Help me please.
curl -XPUT 'http://localhost:9200/_river/animal/_meta' -d '{
"type" : "couchdb",
"couchdb" : {
"host" : "localhost",
"port" : 5984,
"db" : "my_couch_db",
"filter" : "Field/fieldfilters",
},
"index" : {
"index" : "new_index",
"type" : "field",
"bulk_size" : "1000",
"bulk_timeout" : "10ms"
}
}'

have any one the ideas? please say clearly !

On Mar 17, 5:04 pm, Shay Banon kim...@gmail.com wrote:

Yea, you can use a script and update ctx._parent field.

On Fri, Mar 16, 2012 at 1:05 PM, inlier hiquocth...@gmail.com wrote:

I query parent child like this

Mapping

curl -XPOST "http://localhost:9200/new_index" -d '{
"mappings": {
"record": {
"properties": {
"num": {
"type": "long"
}
}
},
"field": {
"_parent": {
"type": "record"
},
"properties": {
"content": {
"type": "string",
"index": "not_analyzed",
"store": "yes"
}
}
}
}
}'

Index data

curl -XPUT 'http://localhost:9200/new_type/record/1'-d '{ //
Please notice id=1
"num" : "frank"
}'
curl -XPUT 'http://localhost:9200/submissions/field/1?parent=1'-d
'{ // Please notice insert parent param =1
"content" : "noodles",
"mnemonic" : "ndl"
}'
curl -XPUT 'http://localhost:9200/submissions/field/2?parent=1'-d
'{ // Please notice insert parent param =1
"content" : "fish",
"mnemonic" : "fsh"
}'

I use the couchdb river to automatic tranfer data from database to
Elasticsearch index. I got problem when must insert parent param ( I
noticed above). How can I config the river to insert parent param.
Maybe I think config in this script. Help me please.
curl -XPUT 'http://localhost:9200/_river/animal/_meta'-d '{
"type" : "couchdb",
"couchdb" : {
"host" : "localhost",
"port" : 5984,
"db" : "my_couch_db",
"filter" : "Field/fieldfilters",
},
"index" : {
"index" : "new_index",
"type" : "field",
"bulk_size" : "1000",
"bulk_timeout" : "10ms"
}
}'

I set the script in river
"script" : "if (ctx._source.parent_field_id) ctx._parent =
ctx._source.parent_field_id" but it not run.

anyone answers?

Hi Shay,

I used the following script to set parent for my couchdb doc with a field
"parent":

if(ctx.doc.parent) ctx._parent = ctx.doc.parent

But some how I didnt see any field "_parent" in the actual index. Is the
above script right syntax?

Thanks.

On Saturday, March 17, 2012 5:04:28 AM UTC-5, kimchy wrote:

Yea, you can use a script and update ctx._parent field.

On Fri, Mar 16, 2012 at 1:05 PM, inlier <hiquo...@gmail.com <javascript:>>wrote:

I query parent child like this

Mapping

curl -XPOST "http://localhost:9200/new_index" -d '{
"mappings": {
"record": {
"properties": {
"num": {
"type": "long"
}
}
},
"field": {
"_parent": {
"type": "record"
},
"properties": {
"content": {
"type": "string",
"index": "not_analyzed",
"store": "yes"
}
}
}
}
}'

Index data

curl -XPUT 'http://localhost:9200/new_type/record/1' -d '{ //
Please notice id=1
"num" : "frank"
}'
curl -XPUT 'http://localhost:9200/submissions/field/1?parent=1' -d
'{ // Please notice insert parent param =1
"content" : "noodles",
"mnemonic" : "ndl"
}'
curl -XPUT 'http://localhost:9200/submissions/field/2?parent=1' -d
'{ // Please notice insert parent param =1
"content" : "fish",
"mnemonic" : "fsh"
}'

I use the couchdb river to automatic tranfer data from database to
Elasticsearch index. I got problem when must insert parent param ( I
noticed above). How can I config the river to insert parent param.
Maybe I think config in this script. Help me please.
curl -XPUT 'http://localhost:9200/_river/animal/_meta' -d '{
"type" : "couchdb",
"couchdb" : {
"host" : "localhost",
"port" : 5984,
"db" : "my_couch_db",
"filter" : "Field/fieldfilters",
},
"index" : {
"index" : "new_index",
"type" : "field",
"bulk_size" : "1000",
"bulk_timeout" : "10ms"
}
}'

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Hello inlier,

Did you find an answer to this question?

Thanks

On Tuesday, March 20, 2012 5:42:32 AM UTC-5, inlier wrote:

anyone answers?

--
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.
For more options, visit https://groups.google.com/groups/opt_out.