Created
July 6, 2011 12:53
-
-
Save nachiketkb/1067158 to your computer and use it in GitHub Desktop.
I am getting error in using a simple script. Can anybody take a look at what is wrong? I want to use doc['field_name'] but it is throwing error. I want to use doc['field_name'] in my code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XPOST localhost:9200/twitter/script -d '{"user" : 1}' | |
{"ok":true,"_index":"twitter","_type":"script","_id":"QdNvKdECReqKmJXz5XhJFw","_version":1} | |
curl -XGET 'localhost:9200/twitter/script/_search?pretty=true' -d ' | |
{ | |
"query": | |
{ | |
"custom_score": | |
{ | |
"query":{"match_all":{}}, | |
"script" : " 1.0 + _source.user" | |
} | |
} | |
}' | |
{ | |
"took" : 5, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, | |
"successful" : 5, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 1, | |
"max_score" : 2.0, | |
"hits" : [ { | |
"_index" : "twitter", | |
"_type" : "script", | |
"_id" : "QdNvKdECReqKmJXz5XhJFw", | |
"_score" : 2.0, "_source" : {"user" : 1} | |
} ] | |
} | |
} | |
curl -XGET 'localhost:9200/twitter/script/_search?pretty=true' -d ' | |
{ | |
"query": | |
{ | |
"custom_score": | |
{ | |
"query":{"match_all":{}}, | |
"script" : " 1.0 + doc['user']" | |
} | |
} | |
}' | |
{ | |
"took" : 7, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, | |
"successful" : 4, | |
"failed" : 1, | |
"failures" : [ { | |
"index" : "twitter", | |
"shard" : 4, | |
"reason" : "QueryPhaseExecutionException[[twitter][4]: query[custom score (ConstantScore(*:*),function=org.elasticsearch.index.query.xcontent.CustomScoreQueryParser$ScriptScoreFunction@1dff935)],from[0],size[10]: Query Failed [Failed to execute main query]]; nested: CompileException[[Error: No field found for [org.elasticsearch.index.field.data.strings.StringDocFieldData@10a3029]]\n[Near : {... 1.0 + doc[user] ....}]\n ^\n[Line: 1, Column: 1]]; nested: ElasticSearchIllegalArgumentException[No field found for [org.elasticsearch.index.field.data.strings.StringDocFieldData@10a3029]]; " | |
} ] | |
}, | |
"hits" : { | |
"total" : 0, | |
"max_score" : null, | |
"hits" : [ ] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment