Top_children with custom score

I had a top_children query with a custom score subquery that was working
fine in 19.4 but has broken when I upgraded to .8.

Here is the gist:

It seems like it's trying to find the child field in the parent's mapping
instead of the child mapping? The error (cm is child mapping, pm is parent
mapping):
{
"error" : "SearchPhaseExecutionException[Failed to execute phase
[query_fetch], total failure; shardFailures
{[N2r-dwPcTVq1Ujf0cE2_gQ][tcbug][0]:
QueryPhaseExecutionException[[tcbug][0]:
query[filtered(score_child[cm/pm](filtered(custom score
(cid:c1,function=script[doc['cval'].value], params
[null]))->cache(_type:cm)))->cache(_type:pm)],from[0],size[2]: Query Failed
[Failed to execute child query [score_child[cm/pm](filtered(custom score
(cid:c1,function=script[doc['cval'].value], params
[null]))->cache(_type:cm))]]]; nested: CompileException[[Error: No field
found for [cval] in mapping with types [pm]]\n[Near : {...
doc['cval'].value ....}]\n ^\n[Line: 1, Column: 1]]; nested:
ElasticSearchIllegalArgumentException[No field found for [cval] in mapping
with types [pm]]; }]",
"status" : 500
}

I already upgraded, is it possible to safely downgrade to 0.19.4 using the
same index files or do I have to rebuild?

Hi Slushi,

The reason that the error occurs, is that in the last curl command in
your bash script
(http://localhost:9200/tcbug/pm/_search?fields=*&pretty=true ...) is
targeted to the pm index only. If you target your request to both
types the error doesn't occur:
http://localhost:9200/tcbug/pm,cm/_search?fields=*&pretty=true

This isn't caused by the top children query, but by a recent change
(better type based inference when using scripts · elastic/elasticsearch@efe85f3 · GitHub)
to scripting. Because of this change only field values can be resolved
that are mapped in the requested types.

Martijn

On 12 July 2012 17:10, slushi kireetreddy@gmail.com wrote:

I had a top_children query with a custom score subquery that was working
fine in 19.4 but has broken when I upgraded to .8.

Here is the gist:
top children scoring bug · GitHub

It seems like it's trying to find the child field in the parent's mapping
instead of the child mapping? The error (cm is child mapping, pm is parent
mapping):
{
"error" : "SearchPhaseExecutionException[Failed to execute phase
[query_fetch], total failure; shardFailures
{[N2r-dwPcTVq1Ujf0cE2_gQ][tcbug][0]:
QueryPhaseExecutionException[[tcbug][0]:
query[filtered(score_child[cm/pm](filtered(custom score
(cid:c1,function=script[doc['cval'].value], params
[null]))->cache(_type:cm)))->cache(_type:pm)],from[0],size[2]: Query Failed
[Failed to execute child query [score_child[cm/pm](filtered(custom score
(cid:c1,function=script[doc['cval'].value], params
[null]))->cache(_type:cm))]]]; nested: CompileException[[Error: No field
found for [cval] in mapping with types [pm]]\n[Near : {... doc['cval'].value
....}]\n ^\n[Line: 1, Column: 1]]; nested:
ElasticSearchIllegalArgumentException[No field found for [cval] in mapping
with types [pm]]; }]",
"status" : 500
}

I already upgraded, is it possible to safely downgrade to 0.19.4 using the
same index files or do I have to rebuild?

--
Met vriendelijke groet,

Martijn van Groningen

That did the trick. Thanks, would have never figured that out on my own.

On Wednesday, July 18, 2012 5:52:10 AM UTC-4, Martijn wrote:

Hi Slushi,

The reason that the error occurs, is that in the last curl command in
your bash script
(http://localhost:9200/tcbug/pm/_search?fields=*&pretty=true ...) is
targeted to the pm index only. If you target your request to both
types the error doesn't occur:
http://localhost:9200/tcbug/pm,cm/_search?fields=*&pretty=true

This isn't caused by the top children query, but by a recent change
(
better type based inference when using scripts · elastic/elasticsearch@efe85f3 · GitHub)

to scripting. Because of this change only field values can be resolved
that are mapped in the requested types.

Martijn

On 12 July 2012 17:10, slushi <kiree...@gmail.com <javascript:>> wrote:

I had a top_children query with a custom score subquery that was working
fine in 19.4 but has broken when I upgraded to .8.

Here is the gist:
top children scoring bug · GitHub

It seems like it's trying to find the child field in the parent's
mapping
instead of the child mapping? The error (cm is child mapping, pm is
parent
mapping):
{
"error" : "SearchPhaseExecutionException[Failed to execute phase
[query_fetch], total failure; shardFailures
{[N2r-dwPcTVq1Ujf0cE2_gQ][tcbug][0]:
QueryPhaseExecutionException[[tcbug][0]:
query[filtered(score_child[cm/pm](filtered(custom score
(cid:c1,function=script[doc['cval'].value], params
[null]))->cache(_type:cm)))->cache(_type:pm)],from[0],size[2]: Query
Failed
[Failed to execute child query [score_child[cm/pm](filtered(custom score
(cid:c1,function=script[doc['cval'].value], params
[null]))->cache(_type:cm))]]]; nested: CompileException[[Error: No field
found for [cval] in mapping with types [pm]]\n[Near : {...
doc['cval'].value
....}]\n ^\n[Line: 1, Column: 1]]; nested:
ElasticSearchIllegalArgumentException[No field found for [cval] in
mapping
with types [pm]]; }]",
"status" : 500
}

I already upgraded, is it possible to safely downgrade to 0.19.4 using
the
same index files or do I have to rebuild?

--
Met vriendelijke groet,

Martijn van Groningen

--