Top_children with custom score


(slushi) #1

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?


(Martijn Van Groningen) #2

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
(https://github.com/elasticsearch/elasticsearch/commit/efe85f322a073313d35f7261bfbe04baa3235de1)
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:
https://gist.github.com/3098693

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


(slushi) #3

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
(
https://github.com/elasticsearch/elasticsearch/commit/efe85f322a073313d35f7261bfbe04baa3235de1)

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:
https://gist.github.com/3098693

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

--


(system) #4