Elasticsearch script filter not working

I added a script filter into the existing query which should match looking
at the data but getting no results back, if i remove the script filter and
i get back results again.

The source document has got a field called publisher name with the value of
Orion which im trying to filter into my results.

Here is my query:

{
"size" : 10, "query" : {
"multi_match" : {
"query" : "happy",
"fields" : [ "isbn", "title^3" ]
}
},
"filter" : {
"script" : {
"script" : "doc['publishername'].value == param1",
"params" : {
"param1" : "Orion"
}
}
}
}

Thanks in advance.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Try:

{
"size" : 10,"query": { "filtered" : { "query" : {
"multi_match" : {
"query" : "happy",
"fields" : [ "isbn", "title^3" ]
}
},
"filter" : {
"script" : {
"script" : "doc['publishername'].value == param1",
"params" : {
"param1" : "Orion"
}
}
}
}
}

}

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Hey,

can you provide a sample document you indexed, which should match (also
your mapping if it is not default)? I did a quick test and it worked:

curl -X PUT 'localhost:9200/foo/bar/1?refresh=true' -d '{ "publishername" :
"Orion", "title" : "Happy Gilmore" }'

curl -X POST localhost:9200/foo/bar/_search -d '{
"size" : 10, "query" : {
"multi_match" : {
"query" : "happy",
"fields" : [ "isbn", "title^3" ]
}
},
"filter" : {
"script" : {
"script" : "doc[\u0027publishername\u0027].value == param1",
"params" : {
"param1" : "orion"
}
}
}
}'

--Alex

On Tue, Aug 20, 2013 at 2:01 AM, Wesley Archbell
wesleyarchbell@gmail.comwrote:

I added a script filter into the existing query which should match looking
at the data but getting no results back, if i remove the script filter and
i get back results again.

The source document has got a field called publisher name with the value
of Orion which im trying to filter into my results.

Here is my query:

{
"size" : 10, "query" : {
"multi_match" : {
"query" : "happy",
"fields" : [ "isbn", "title^3" ]
}
},
"filter" : {
"script" : {
"script" : "doc['publishername'].value == param1",
"params" : {
"param1" : "Orion"
}
}
}
}

Thanks in advance.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Here is a sample:

{
_index: book-index
_type: book
_id: 50700b02e4b06fd4b975911d
_score: 5.348893
_source: {
_id: 50700b02e4b06fd4b975911d
recordreference: 9781845903237
notificationtype: 03
productidentifier: {
15: 9781845903237
: 9781845903237
02: 1845903234
03: 9781845903237
}
isbn: 9781845903237
productform: DG
productclassificationtype: null
productclassificationcode: null
epubtype: 029
titleofseries: null
numberwithinseries: null
titletype: 01
title: Happy Kids Happy You
websitelink: null
contributor[0]: {
personname:
personnameinverted: Beever, Sue
contributorrole: A01
keynames:
}
contributor[1]: {
personname:
personnameinverted: Jarvis, Clare
contributorrole: A12
keynames:
}
languagerole: 01
languagecode: eng
editionnumber: null
numberofpages: 256
basicmainsubject: FAM034000
subject[0]: {
subjectschemeidentifier: 10
subjectcode: SEL037000
}
texttypecode: 01
textformat: null
text:

Every child, every family situation is different and parenting is a journey of constant change. There are no �right answers”, only what works for you and your family. This book will give you a toolkit of practical NLP (Neuro Linguistic Programming) methods flexible enough to cover all situations. It focuses equally on the needs of you, the parent, as well as your child and will help you: get your family life running more smoothly; understand your children; support and encourage them and their development more effectively; recognise and meet your own needs so you can be more resourceful in family life; feel more confident and positive so you can have fun and enjoy being a parent more of the time! Rather than giving prescriptive advice, Happy Kids Happy You will enable you to develop your own solutions to situations. You will learn to speak and behave more positively with your children and experience outstanding results!

imprintname: Crown House Publishing
publishingrole: 01
publishername: Crown House Publishing
publishingstatus: 04
publishingstatusnote: null
publicationdate: 2009-11-09T13:00:00.000Z
salesrightstype: 01
rightscountry: AD AE AF AG AI AL AM AN AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR ST SV SY SZ TC TD TF TG TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS YE YT ZA ZM ZW
notforsale: null
rightsterritory: null
yearFirstPublished: null
agentname: null
agentrole: null
marketcountry: null
marketpublishingstatus: null
marketdaterole: null
date: null
collection: faberandfaber
}
}

Query:

{
"size" : 10, "query" : {
"multi_match" : {
"query" : "happy",
"fields" : [ "isbn", "title^3"]
}
},
"filter" : {
"script" : {
"script" : "doc['publishername'].value == param1",
"params" : {
"param1" : "Crown House Publishing"
}
}
}

Mappings:

"mappings" : {
"book" : {
"properties" : {
"title" : { "type" : "string", "analyzer" : "title-analyzer" },
"publicationdate" : { "type" : "date", "format" : "date_time" }
}
}
}

On 20/08/2013, at 4:39 PM, Alexander Reelsen alr@spinscale.de wrote:

Hey,

can you provide a sample document you indexed, which should match (also your mapping if it is not default)? I did a quick test and it worked:

curl -X PUT 'localhost:9200/foo/bar/1?refresh=true' -d '{ "publishername" : "Orion", "title" : "Happy Gilmore" }'

curl -X POST localhost:9200/foo/bar/_search -d '{
"size" : 10, "query" : {
"multi_match" : {
"query" : "happy",
"fields" : [ "isbn", "title^3" ]
}
},
"filter" : {
"script" : {
"script" : "doc[\u0027publishername\u0027].value == param1",
"params" : {
"param1" : "orion"
}
}
}
}'

--Alex

On Tue, Aug 20, 2013 at 2:01 AM, Wesley Archbell wesleyarchbell@gmail.com wrote:
I added a script filter into the existing query which should match looking at the data but getting no results back, if i remove the script filter and i get back results again.

The source document has got a field called publisher name with the value of Orion which im trying to filter into my results.

Here is my query:

{
"size" : 10, "query" : {
"multi_match" : {
"query" : "happy",
"fields" : [ "isbn", "title^3" ]
}
},
"filter" : {
"script" : {
"script" : "doc['publishername'].value == param1",
"params" : {
"param1" : "Orion"
}
}
}
}

Thanks in advance.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to a topic in the Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elasticsearch/Tid9M0T4ZNE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Ive tried using a java mvel script and then calling it and that works

On 20/08/2013, at 4:39 PM, Alexander Reelsen alr@spinscale.de wrote:

Hey,

can you provide a sample document you indexed, which should match (also your mapping if it is not default)? I did a quick test and it worked:

curl -X PUT 'localhost:9200/foo/bar/1?refresh=true' -d '{ "publishername" : "Orion", "title" : "Happy Gilmore" }'

curl -X POST localhost:9200/foo/bar/_search -d '{
"size" : 10, "query" : {
"multi_match" : {
"query" : "happy",
"fields" : [ "isbn", "title^3" ]
}
},
"filter" : {
"script" : {
"script" : "doc[\u0027publishername\u0027].value == param1",
"params" : {
"param1" : "orion"
}
}
}
}'

--Alex

On Tue, Aug 20, 2013 at 2:01 AM, Wesley Archbell wesleyarchbell@gmail.com wrote:
I added a script filter into the existing query which should match looking at the data but getting no results back, if i remove the script filter and i get back results again.

The source document has got a field called publisher name with the value of Orion which im trying to filter into my results.

Here is my query:

{
"size" : 10, "query" : {
"multi_match" : {
"query" : "happy",
"fields" : [ "isbn", "title^3" ]
}
},
"filter" : {
"script" : {
"script" : "doc['publishername'].value == param1",
"params" : {
"param1" : "Orion"
}
}
}
}

Thanks in advance.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to a topic in the Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elasticsearch/Tid9M0T4ZNE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.