Hi. I am having trouble trying to set the parent attribute for a child
document and was wondering if someone could suggest to me what i'm doing
wrong.
I have a type called "feedback" which I want to assign a parent attribute -
i want "feedback" to be a child of "content" - so i do the following:
curl -XPUT http://localhost:9200/myindex/feedback/_mapping -d '
{
"feedback" : {
-
"_parent" : {*
-
"type" : "content"*
-
}*
-
}*
}'
My java code to insert a document of type "feedback" look like this:
IndexResponse response = _client.prepareIndex(INDEX, TYPE_FEEDBACK,
feedback.getFeedbackId()).setParent(""+feedback.getContentId()).setSource(feedbackJSON.toString())
.execute().actionGet();
I got back the response fine - and the response had the correct index,
type, and id.
However, If i try to fetch what i just inserted:
curl -XGET http://localhost:9200/myindex/feedback/${1}?pretty=true
I get nothing:
{
-
"_index" : "myindex",*
-
"_type" : "feedback",*
-
"_id" : "3860",*
-
"exists" : false*
}
If I examine the mapping, I think it looks ok:
curl -XGET http://localhost:9200/myindex/feedback/_mapping
{"feedback":{"_parent":{"type":"content"},"_routing":{"required":true},"properties":{"cid":{"type":"long"},"cmi":{"type":"long"},"cp":{"type":"long"},"ct":{"type":"long"},"cwn":{"type":"long"},"dur":{"type":"long"},"fee":{"type":"long"},"ia":{"type":"long"},"ito":{"type":"long"},"mir":{"type":"long"},"mvd":{"type":"long"},"mvt":{"type":"long"},"n":{"type":"string"},"own":{"type":"long"},"pdt":{"type":"long"},"sav":{"type":"string"},"td":{"type":"long"}}}}
If just search for all id's for that type, I do see the entry:
curl http://localhost:9200/myindex/feedback/_search?pretty=true -d '
*{ *
-
"query" : { *
-
"match_all" : {} *
-
},*
-
"fields": []*
}
'
{
-
"took" : 13,*
-
"timed_out" : false,*
-
"_shards" : {*
-
"total" : 5,*
-
"successful" : 5,*
-
"failed" : 0*
-
},*
-
"hits" : {*
-
"total" : 3,*
-
"max_score" : 1.0,*
-
"hits" : [ {*
-
"_index" : "myindex",*
-
"_type" : "feedback",*
-
"_id" : "1_3858",*
-
"_score" : 1.0*
-
}, {*
-
"_index" : "myindex",*
-
"_type" : "feedback",*
-
"_id" : "1_3859",*
-
"_score" : 1.0*
-
}, {*
-
"_index" : "myindex",*
-
"_type" : "feedback",*
-
"_id" : "3860",*
-
"_score" : 1.0*
-
} ]*
-
}*
}
Could someone tell me what I could be missing? This is version 0.90
Many thanks,
Ed
--
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/8fd5d014-73f9-4f7b-b7d5-a8a73e3c2151%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.