Here i have mentioned Parent table mapping
$ curl -XGET 'http://localhost:9200/db54/metadata/_mapping'
{"db54":{"metadata":{"_source":{"enabled":false},"properties":
{"field1":
{"store":"yes","analyzer":"keyword","type":"string"},"field2":
{"store":"yes","analyzer":"keyword","term_vector":"with_positions_offse
ts","type":"string"},"field3":
{"store":"yes","analyzer":"standard","type":
"string"},"field4":
{"store":"yes","analyzer":"standard","term_vector":"with
_positions_offsets","type":"string"}}}}}
Here i have mentioned Child table mapping
$ curl -XGET 'http://localhost:9200/db54/included/_mapping'
{"db54":{"included":{"_routing":{"required":true},"properties":
{"_included":{"st
ore":"yes","analyzer":"standard","type":"string"},"parentrelationid":
{"omit_term
_freq_and_positions":false,"index":"analyzed","omit_norms":false,"store":"yes","
type":"long"},"_updatedby":
{"omit_term_freq_and_positions":false,"omit_norms":fa
lse,"store":"yes","type":"long"},"_updatedon":
{"omit_term_freq_and_positions":fa
lse,"omit_norms":false,"store":"yes","format":"MMM/dd/yyyy
HH:mm:ss","type":"dat
e"}},"_parent":{"type":"metadata"}}}}
I am searching using the below query
$ curl -XGET 'http://localhost:9200/db54/metadata/_search'?pretty=true
-d '
{ "query":{"has_child" : {"type" : "included", "query" :{ "term" :
{ "_included
":"status2status" } }} } }'
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 3,
"failed" : 2,
"failures" : [ {
"index" : "db54",
"shard" : 3,
"reason" : "QueryPhaseExecutionException[[db54][3]:
query[ConstantScore(ch
ild_filter[included/metadata](filtered(_included:status2status)-
FilterCacheFilt
erWrapper(_type:included)))],from[0],size[10]: Query Failed [Failed to
execute c
hild query [filtered(_included:status2status)-
FilterCacheFilterWrapper(_type:in
cluded)]]]; nested: "
}, {
"index" : "db54",
"shard" : 4,
"reason" : "QueryPhaseExecutionException[[db54][4]:
query[ConstantScore(ch
ild_filter[included/metadata](filtered(_included:status2status)-
FilterCacheFilt
erWrapper(_type:included)))],from[0],size[10]: Query Failed [Failed to
execute c
hild query [filtered(_included:status2status)-
FilterCacheFilterWrapper(_type:in
cluded)]]]; nested: "
} ]
},
"hits" : {
"total" : 53,
"max_score" : 1.0,
"hits" : [ {
"_index" : "db54",
"_type" : "metadata",
"_id" : "0010000037",
"_score" : 1.0
}, {
"_index" : "db54",
"_type" : "metadata",
"_id" : "0010000044",
"_score" : 1.0
}, {
"_index" : "db54",
"_type" : "metadata",
"_id" : "0010000049",
"_score" : 1.0
}, {
"_index" : "db54",
"_type" : "metadata",
"_id" : "0010000051",
"_score" : 1.0
}, {
"_index" : "db54",
"_type" : "metadata",
"_id" : "0010000056",
"_score" : 1.0
}, {
"_index" : "db54",
"_type" : "metadata",
"_id" : "0010000063",
"_score" : 1.0
}, {
"_index" : "db54",
"_type" : "metadata",
"_id" : "0010000068",
"_score" : 1.0
}, {
"_index" : "db54",
"_type" : "metadata",
"_id" : "0010000070",
"_score" : 1.0
}, {
"_index" : "db54",
"_type" : "metadata",
"_id" : "0010000075",
"_score" : 1.0
}, {
"_index" : "db54",
"_type" : "metadata",
"_id" : "0010000082",
"_score" : 1.0
} ]
}
}
I have 90 documents in parent and child table, but i am getting only
53 documents here.
On Apr 19, 2:03 pm, Shay Banon shay.ba...@elasticsearch.com wrote:
Can you gist a recreation? Seehttp://www.elasticsearch.org/help
On Monday, April 18, 2011 at 12:48 PM, senthil prabhu wrote:
Hi All,
To retrieve documents in parent table i am using the "has-
child query". I have 9 documents in child table but while querying i
am getting only 5 documents with Exception.
I am using the elasticsearch version 15.2
curl -XGET 'http://localhost:9200/db54/metadata/_search'-d '{ "query":
{"has_child" : {"type" : "childtable", "query" :{ "term" : { "field1":
"12" } }} } }'
{"took":0,"timed_out":false,"_shards":{"total":5,"successful":
3,"failed":2,"fail
ures":[{"index":"db54","shard":
3,"reason":"QueryPhaseExecutionException[[db54][3
]: query[ConstantScore(child_filter[childtable/metadata]
(filtered(field1:12)-
FilterCacheFilterWrapper(_type:childtable)))],from[0],size[10]: Query
Fa
iled [Failed to execute child query [filtered(_included:status2status)-
FilterCa
cheFilterWrapper(_type:childtable)]]]; nested: "},
{"index":"db54","shard":4,"reaso
n":"QueryPhaseExecutionException[[db54][4]:
query[ConstantScore(child_filter[childtable/metadata](filtered(field1:
12)->FilterCacheFilterWrapper(_typ
e:childtable)))],from[0],size[10]: Query Failed [Failed to execute
child query [fi
ltered(field1:12)->FilterCacheFilterWrapper(_type:childtable)]]]; ne
sted: "}]},"hits":{"total":53,"max_score":1.0,"hits":
[{"_index":"db54","_type":"
metadata","_id":"0010000013","_score":1.0},
{"_index":"db54","_type":"metadata","
_id":"0010000018","_score":1.0},
{"_index":"db54","_type":"metadata","_id":"00100
00020","_score":1.0},
{"_index":"db54","_type":"metadata","_id":"0010000025","_sc
ore":1.0},
{"_index":"db54","_type":"metadata","_id":"0010000032","_score":1.0},{
"_index":"db54","_type":"metadata","_id":"0010000037","_score":1.0},
{"_index":"d
b54","_type":"metadata","_id":"0010000044","_score":1.0},
{"_index":"db54","_type
":"metadata","_id":"0010000049","_score":1.0},
{"_index":"db54","_type":"metadata
","_id":"0010000051","_score":1.0},
{"_index":"db54","_type":"metadata","_id":"00
10000056","_score":1.0}]}}
Can any one help me to move forward...