Eric_4
(Eric-4)
September 30, 2013, 10:11am
1
I have following query in a file called query.json
{
"script_fields": {
"correctYear": {
"script": "_source.year – 1800"
}
},
"query": {
"term": {
"title": "crime"
}
}
}
I then execute the query in command-line as below.
curl -XGET 'localhost:9200/library/book/_search?pretty=true' -d @query.json
But I get an error.
SearchPhaseExecutionException: Error: unknown class or illegal statement:
org.elasticsearch.common.mvel2.ParserContext@7a0bd150
The data type of "year" field is long.
Thank you.
--
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 .
mvg
(Martijn Van Groningen)
September 30, 2013, 11:56am
2
Hi Eric,
The minus operator is -
and not –
. The following script should work:
{
"script_fields": {
"correctYear": {
"script": "_source.year - 1800"
}
}
}
Martijn
On 30 September 2013 12:11, Eric gayanath@gmail.com wrote:
I have following query in a file called query.json
{
"script_fields": {
"correctYear": {
"script": "_source.year – 1800"
}
},
"query": {
"term": {
"title": "crime"
}
}
}
I then execute the query in command-line as below.
curl -XGET 'localhost:9200/library/book/_search?pretty=true' -d @query.json
But I get an error.
SearchPhaseExecutionException: Error: unknown class or illegal statement:
org.elasticsearch.common.mvel2.ParserContext@7a0bd150
The data type of "year" field is long.
Thank you.
--
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 .
--
Met vriendelijke groet,
Martijn van Groningen
--
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 .
Eric_4
(Eric-4)
October 1, 2013, 4:09am
3
Hi Martijn,
Thanks a lot! This resolved the issue.
I copied the example from a PDF file. That should be the cause for this
character.
On Monday, September 30, 2013 7:56:06 PM UTC+8, Martijn v Groningen wrote:
Hi Eric,
The minus operator is -
and not –
. The following script should work:
{
"script_fields": {
"correctYear": {
"script": "_source.year - 1800"
}
}
}
Martijn
On 30 September 2013 12:11, Eric <gaya...@gmail.com <javascript:>> wrote:
I have following query in a file called query.json
{
"script_fields": {
"correctYear": {
"script": "_source.year – 1800"
}
},
"query": {
"term": {
"title": "crime"
}
}
}
I then execute the query in command-line as below.
curl -XGET 'localhost:9200/library/book/_search?pretty=true' -d
@query.json
But I get an error.
SearchPhaseExecutionException: Error: unknown class or illegal statement:
org.elasticsearch.common.mvel2.ParserContext@7a0bd150
The data type of "year" field is long.
Thank you.
--
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 elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out .
--
Met vriendelijke groet,
Martijn van Groningen
--
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 .