Hi there,
Seeing two pieces of unexpected behavior here:
$ curl -s -XDELETE http://localhost:9200/?pretty=true
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPOST http://localhost:9200/test?pretty=true
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT http://localhost:9200/test/post/_mapping?pretty=true -
d '{"post":{"properties":{"title":{"type":"string"}}}}'
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT http://localhost:9200/test/comment/_mapping?pretty=true
-d '{"comment":{"_parent":{"type":"post"},"properties":{"content":
{"type":"string"}}}}'
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT http://localhost:9200/test/post/1 -d '{"title":"Test
Post"}'
{"ok":true,"_index":"test","_type":"post","_id":"1","_version":1}
$ curl -s -XPUT 'http://localhost:9200/test/comment/2 ?
parent=1&pretty=true&refresh=true' -d '{"content":"Test Comment"}'
{
"ok" : true,
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"_version" : 1
}
$ curl -s http://localhost:9200/test/comment/2?pretty=true
{
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"exists" : false
}
$ curl -s http://localhost:9200/test/comment/_search?pretty=true
{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"_score" : 1.0, "_source" : {"content":"Test Comment"}
} ]
}
}
It seems that I can't look up the document at all when I index it
with a parent param.
I note that the search result doesn't contain a reference to the
parent. Is there a way to access the parent when retrieving the doc?
Am I doing something wrong?
Thanks!
Mat
kimchy
(Shay Banon)
October 2, 2011, 1:14pm
2
Because the parent parameter controls the routing, you need to provide
the parent value in the routing parameter when you do a GET for the child
document.
Ask for _parent in the fields when you search / GET the doc. As for both
_source and _parent if you want both.
On Sat, Oct 1, 2011 at 7:46 PM, Mat Brown mat.a.brown@gmail.com wrote:
Hi there,
Seeing two pieces of unexpected behavior here:
$ curl -s -XDELETE http://localhost:9200/?pretty=true
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPOST http://localhost:9200/test?pretty=true
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT http://localhost:9200/test/post/_mapping?pretty=true -
d '{"post":{"properties":{"title":{"type":"string"}}}}'
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT http://localhost:9200/test/comment/_mapping?pretty=true
-d '{"comment":{"_parent":{"type":"post"},"properties":{"content":
{"type":"string"}}}}'
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT http://localhost:9200/test/post/1 -d '{"title":"Test
Post"}'
{"ok":true,"_index":"test","_type":"post","_id":"1","_version":1}
$ curl -s -XPUT 'http://localhost:9200/test/comment/2 ?
parent=1&pretty=true&refresh=true' -d '{"content":"Test Comment"}'
{
"ok" : true,
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"_version" : 1
}
$ curl -s http://localhost:9200/test/comment/2?pretty=true
{
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"exists" : false
}
$ curl -s http://localhost:9200/test/comment/_search?pretty=true
{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"_score" : 1.0, "_source" : {"content":"Test Comment"}
} ]
}
}
It seems that I can't look up the document at all when I index it
with a parent param.
I note that the search result doesn't contain a reference to the
parent. Is there a way to access the parent when retrieving the doc?
Am I doing something wrong?
Thanks!
Mat
Thank you!!!
On Oct 2, 2011 6:14 AM, "Shay Banon" kimchy@gmail.com wrote:
Because the parent parameter controls the routing, you need to provide
the parent value in the routing parameter when you do a GET for the child
document.
Ask for _parent in the fields when you search / GET the doc. As for
both
_source and _parent if you want both.
On Sat, Oct 1, 2011 at 7:46 PM, Mat Brown mat.a.brown@gmail.com wrote:
Hi there,
Seeing two pieces of unexpected behavior here:
$ curl -s -XDELETE http://localhost:9200/?pretty=true
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPOST http://localhost:9200/test?pretty=true
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT http://localhost:9200/test/post/_mapping?pretty=true -
d '{"post":{"properties":{"title":{"type":"string"}}}}'
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT http://localhost:9200/test/comment/_mapping?pretty=true
-d '{"comment":{"_parent":{"type":"post"},"properties":{"content":
{"type":"string"}}}}'
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT http://localhost:9200/test/post/1 -d '{"title":"Test
Post"}'
{"ok":true,"_index":"test","_type":"post","_id":"1","_version":1}
$ curl -s -XPUT 'http://localhost:9200/test/comment/2 ?
parent=1&pretty=true&refresh=true' -d '{"content":"Test Comment"}'
{
"ok" : true,
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"_version" : 1
}
$ curl -s http://localhost:9200/test/comment/2?pretty=true
{
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"exists" : false
}
$ curl -s http://localhost:9200/test/comment/_search?pretty=true
{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"_score" : 1.0, "_source" : {"content":"Test Comment"}
} ]
}
}
It seems that I can't look up the document at all when I index it
with a parent param.
I note that the search result doesn't contain a reference to the
parent. Is there a way to access the parent when retrieving the doc?
Am I doing something wrong?
Thanks!
Mat
Hey Shay,
No such luck:
$ curl -s -XDELETE 'http://localhost:9200/?pretty=true '
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPOST 'http://localhost:9200/test?pretty=true '
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT 'http://localhost:9200/test/post/_mapping?pretty=true '
-d '{"post":{"properties":{"title":{"type":"string"}}}}'
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT
'http://localhost:9200/test/comment/_mapping?pretty=true ' -d
'{"comment":{"_parent":{"type":"post"},"properties":{"content":
{"type":"string"}}}}'
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT http://localhost:9200/test/post/1 -d '{"title":"Test Post"}'
{"ok":true,"_index":"test","_type":"post","_id":"1","_version":1}
$ curl -s -XPUT
'http://localhost:9200/test/comment/2?parent=1&pretty=true&refresh=true '
-d '{"content":"Test Comment"}'
{
"ok" : true,
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"_version" : 1
}
$ curl -s 'http://localhost:9200/test/comment/2?parent=1&pretty=true '
{
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"exists" : false
}
$ curl -s 'http://localhost:9200/test/comment/_search?pretty=true '
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"_score" : 1.0, "_source" : {"content":"Test Comment"}
} ]
}
}
Anything else I might be doing wrong? Thanks!
Mat
On Sun, Oct 2, 2011 at 10:27, Matthew A. Brown mat.a.brown@gmail.com wrote:
Thank you!!!
On Oct 2, 2011 6:14 AM, "Shay Banon" kimchy@gmail.com wrote:
Because the parent parameter controls the routing, you need to provide
the parent value in the routing parameter when you do a GET for the child
document.
Ask for _parent in the fields when you search / GET the doc. As for
both
_source and _parent if you want both.
On Sat, Oct 1, 2011 at 7:46 PM, Mat Brown mat.a.brown@gmail.com wrote:
Hi there,
Seeing two pieces of unexpected behavior here:
$ curl -s -XDELETE http://localhost:9200/?pretty=true
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPOST http://localhost:9200/test?pretty=true
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT http://localhost:9200/test/post/_mapping?pretty=true -
d '{"post":{"properties":{"title":{"type":"string"}}}}'
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT http://localhost:9200/test/comment/_mapping?pretty=true
-d '{"comment":{"_parent":{"type":"post"},"properties":{"content":
{"type":"string"}}}}'
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT http://localhost:9200/test/post/1 -d '{"title":"Test
Post"}'
{"ok":true,"_index":"test","_type":"post","_id":"1","_version":1}
$ curl -s -XPUT 'http://localhost:9200/test/comment/2 ?
parent=1&pretty=true&refresh=true' -d '{"content":"Test Comment"}'
{
"ok" : true,
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"_version" : 1
}
$ curl -s http://localhost:9200/test/comment/2?pretty=true
{
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"exists" : false
}
$ curl -s http://localhost:9200/test/comment/_search?pretty=true
{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"_score" : 1.0, "_source" : {"content":"Test Comment"}
} ]
}
}
It seems that I can't look up the document at all when I index it
with a parent param.
I note that the search result doesn't contain a reference to the
parent. Is there a way to access the parent when retrieving the doc?
Am I doing something wrong?
Thanks!
Mat
kimchy
(Shay Banon)
October 4, 2011, 4:48pm
5
From briefly looking at it (on the go...), you should pass routing=1 for the
get request, there is no handle for parent (which effectively is the
routing).
On Tue, Oct 4, 2011 at 6:22 PM, Matthew A. Brown mat.a.brown@gmail.com wrote:
Hey Shay,
No such luck:
$ curl -s -XDELETE 'http://localhost:9200/?pretty=true '
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPOST 'http://localhost:9200/test?pretty=true '
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT 'http://localhost:9200/test/post/_mapping?pretty=true '
-d '{"post":{"properties":{"title":{"type":"string"}}}}'
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT
'http://localhost:9200/test/comment/_mapping?pretty=true ' -d
'{"comment":{"_parent":{"type":"post"},"properties":{"content":
{"type":"string"}}}}'
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT http://localhost:9200/test/post/1 -d '{"title":"Test
Post"}'
{"ok":true,"_index":"test","_type":"post","_id":"1","_version":1}
$ curl -s -XPUT
'http://localhost:9200/test/comment/2?parent=1&pretty=true&refresh=true '
-d '{"content":"Test Comment"}'
{
"ok" : true,
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"_version" : 1
}
$ curl -s 'http://localhost:9200/test/comment/2?parent=1&pretty=true '
{
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"exists" : false
}
$ curl -s 'http://localhost:9200/test/comment/_search?pretty=true '
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"_score" : 1.0, "_source" : {"content":"Test Comment"}
} ]
}
}
Anything else I might be doing wrong? Thanks!
Mat
On Sun, Oct 2, 2011 at 10:27, Matthew A. Brown mat.a.brown@gmail.com
wrote:
Thank you!!!
On Oct 2, 2011 6:14 AM, "Shay Banon" kimchy@gmail.com wrote:
Because the parent parameter controls the routing, you need to
provide
the parent value in the routing parameter when you do a GET for the
child
document.
Ask for _parent in the fields when you search / GET the doc. As for
both
_source and _parent if you want both.
On Sat, Oct 1, 2011 at 7:46 PM, Mat Brown mat.a.brown@gmail.com
wrote:
Hi there,
Seeing two pieces of unexpected behavior here:
$ curl -s -XDELETE http://localhost:9200/?pretty=true
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPOST http://localhost:9200/test?pretty=true
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT http://localhost:9200/test/post/_mapping?pretty=true -
d '{"post":{"properties":{"title":{"type":"string"}}}}'
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT
http://localhost:9200/test/comment/_mapping?pretty=true
-d '{"comment":{"_parent":{"type":"post"},"properties":{"content":
{"type":"string"}}}}'
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT http://localhost:9200/test/post/1 -d '{"title":"Test
Post"}'
{"ok":true,"_index":"test","_type":"post","_id":"1","_version":1}
$ curl -s -XPUT 'http://localhost:9200/test/comment/2 ?
parent=1&pretty=true&refresh=true' -d '{"content":"Test Comment"}'
{
"ok" : true,
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"_version" : 1
}
$ curl -s http://localhost:9200/test/comment/2?pretty=true
{
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"exists" : false
}
$ curl -s http://localhost:9200/test/comment/_search?pretty=true
{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"_score" : 1.0, "_source" : {"content":"Test Comment"}
} ]
}
}
It seems that I can't look up the document at all when I index it
with a parent param.
I note that the search result doesn't contain a reference to the
parent. Is there a way to access the parent when retrieving the doc?
Am I doing something wrong?
Thanks!
Mat
Ah, got it. Thank you! So the routing
param should just always be
the parent ID?
On Tue, Oct 4, 2011 at 10:48, Shay Banon kimchy@gmail.com wrote:
From briefly looking at it (on the go...), you should pass routing=1 for the
get request, there is no handle for parent (which effectively is the
routing).
On Tue, Oct 4, 2011 at 6:22 PM, Matthew A. Brown mat.a.brown@gmail.com
wrote:
Hey Shay,
No such luck:
$ curl -s -XDELETE 'http://localhost:9200/?pretty=true '
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPOST 'http://localhost:9200/test?pretty=true '
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT 'http://localhost:9200/test/post/_mapping?pretty=true '
-d '{"post":{"properties":{"title":{"type":"string"}}}}'
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT
'http://localhost:9200/test/comment/_mapping?pretty=true ' -d
'{"comment":{"_parent":{"type":"post"},"properties":{"content":
{"type":"string"}}}}'
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT http://localhost:9200/test/post/1 -d '{"title":"Test
Post"}'
{"ok":true,"_index":"test","_type":"post","_id":"1","_version":1}
$ curl -s -XPUT
'http://localhost:9200/test/comment/2?parent=1&pretty=true&refresh=true '
-d '{"content":"Test Comment"}'
{
"ok" : true,
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"_version" : 1
}
$ curl -s 'http://localhost:9200/test/comment/2?parent=1&pretty=true '
{
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"exists" : false
}
$ curl -s 'http://localhost:9200/test/comment/_search?pretty=true '
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"_score" : 1.0, "_source" : {"content":"Test Comment"}
} ]
}
}
Anything else I might be doing wrong? Thanks!
Mat
On Sun, Oct 2, 2011 at 10:27, Matthew A. Brown mat.a.brown@gmail.com
wrote:
Thank you!!!
On Oct 2, 2011 6:14 AM, "Shay Banon" kimchy@gmail.com wrote:
Because the parent parameter controls the routing, you need to
provide
the parent value in the routing parameter when you do a GET for the
child
document.
Ask for _parent in the fields when you search / GET the doc. As for
both
_source and _parent if you want both.
On Sat, Oct 1, 2011 at 7:46 PM, Mat Brown mat.a.brown@gmail.com
wrote:
Hi there,
Seeing two pieces of unexpected behavior here:
$ curl -s -XDELETE http://localhost:9200/?pretty=true
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPOST http://localhost:9200/test?pretty=true
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT http://localhost:9200/test/post/_mapping?pretty=true -
d '{"post":{"properties":{"title":{"type":"string"}}}}'
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT
http://localhost:9200/test/comment/_mapping?pretty=true
-d '{"comment":{"_parent":{"type":"post"},"properties":{"content":
{"type":"string"}}}}'
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT http://localhost:9200/test/post/1 -d '{"title":"Test
Post"}'
{"ok":true,"_index":"test","_type":"post","_id":"1","_version":1}
$ curl -s -XPUT 'http://localhost:9200/test/comment/2 ?
parent=1&pretty=true&refresh=true' -d '{"content":"Test Comment"}'
{
"ok" : true,
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"_version" : 1
}
$ curl -s http://localhost:9200/test/comment/2?pretty=true
{
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"exists" : false
}
$ curl -s http://localhost:9200/test/comment/_search?pretty=true
{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"_score" : 1.0, "_source" : {"content":"Test Comment"}
} ]
}
}
It seems that I can't look up the document at all when I index it
with a parent param.
I note that the search result doesn't contain a reference to the
parent. Is there a way to access the parent when retrieving the doc?
Am I doing something wrong?
Thanks!
Mat
kimchy
(Shay Banon)
October 4, 2011, 10:40pm
7
Yes, this is effectively what happens when you set the parent value when
indexing.
On Tue, Oct 4, 2011 at 6:54 PM, Matthew A. Brown mat.a.brown@gmail.com wrote:
Ah, got it. Thank you! So the routing
param should just always be
the parent ID?
On Tue, Oct 4, 2011 at 10:48, Shay Banon kimchy@gmail.com wrote:
From briefly looking at it (on the go...), you should pass routing=1 for
the
get request, there is no handle for parent (which effectively is the
routing).
On Tue, Oct 4, 2011 at 6:22 PM, Matthew A. Brown mat.a.brown@gmail.com
wrote:
Hey Shay,
No such luck:
$ curl -s -XDELETE 'http://localhost:9200/?pretty=true '
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPOST 'http://localhost:9200/test?pretty=true '
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT 'http://localhost:9200/test/post/_mapping?pretty=true '
-d '{"post":{"properties":{"title":{"type":"string"}}}}'
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT
'http://localhost:9200/test/comment/_mapping?pretty=true ' -d
'{"comment":{"_parent":{"type":"post"},"properties":{"content":
{"type":"string"}}}}'
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT http://localhost:9200/test/post/1 -d '{"title":"Test
Post"}'
{"ok":true,"_index":"test","_type":"post","_id":"1","_version":1}
$ curl -s -XPUT
'http://localhost:9200/test/comment/2?parent=1&pretty=true&refresh=true
'
-d '{"content":"Test Comment"}'
{
"ok" : true,
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"_version" : 1
}
$ curl -s 'http://localhost:9200/test/comment/2?parent=1&pretty=true '
{
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"exists" : false
}
$ curl -s 'http://localhost:9200/test/comment/_search?pretty=true '
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"_score" : 1.0, "_source" : {"content":"Test Comment"}
} ]
}
}
Anything else I might be doing wrong? Thanks!
Mat
On Sun, Oct 2, 2011 at 10:27, Matthew A. Brown mat.a.brown@gmail.com
wrote:
Thank you!!!
On Oct 2, 2011 6:14 AM, "Shay Banon" kimchy@gmail.com wrote:
Because the parent parameter controls the routing, you need to
provide
the parent value in the routing parameter when you do a GET for the
child
document.
Ask for _parent in the fields when you search / GET the doc. As
for
both
_source and _parent if you want both.
On Sat, Oct 1, 2011 at 7:46 PM, Mat Brown mat.a.brown@gmail.com
wrote:
Hi there,
Seeing two pieces of unexpected behavior here:
$ curl -s -XDELETE http://localhost:9200/?pretty=true
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPOST http://localhost:9200/test?pretty=true
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT
http://localhost:9200/test/post/_mapping?pretty=true -
d '{"post":{"properties":{"title":{"type":"string"}}}}'
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT
http://localhost:9200/test/comment/_mapping?pretty=true
-d '{"comment":{"_parent":{"type":"post"},"properties":{"content":
{"type":"string"}}}}'
{
"ok" : true,
"acknowledged" : true
}
$ curl -s -XPUT http://localhost:9200/test/post/1 -d
'{"title":"Test
Post"}'
{"ok":true,"_index":"test","_type":"post","_id":"1","_version":1}
$ curl -s -XPUT 'http://localhost:9200/test/comment/2 ?
parent=1&pretty=true&refresh=true' -d '{"content":"Test Comment"}'
{
"ok" : true,
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"_version" : 1
}
$ curl -s http://localhost:9200/test/comment/2?pretty=true
{
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"exists" : false
}
$ curl -s http://localhost:9200/test/comment/_search?pretty=true
{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "test",
"_type" : "comment",
"_id" : "2",
"_score" : 1.0, "_source" : {"content":"Test Comment"}
} ]
}
}
It seems that I can't look up the document at all when I index it
with a parent param.
I note that the search result doesn't contain a reference to the
parent. Is there a way to access the parent when retrieving the doc?
Am I doing something wrong?
Thanks!
Mat