Thanks Luiz, that was really helpful :) The examples in the guide could be
made more helpful. After you pointed out the the location of the error I
got it working with
{
"query": {
"function_score": {
"boost_mode": "replace",
"query": {
"match": { "design.PRODUCT_DESC":"cool"}
},
"script_score": {
"params": {
"param1": 2,
"param2": 3.1
},
"script": "_score * doc['design.CLICKS'].value / pow(param1,
param2)"
}
}
}
}
Thanks
Srini
On Thursday, April 3, 2014 1:55:57 PM UTC-7, Luiz Guilherme wrote:
>
> Hi Srinivasan,
>
> It seems your intern "query" is malformed. Try this:
>
> {
> "query": {
> "function_score": {
> "boost_mode": "replace",
> "query": {
> "match_all": {}
> },
> "script_score": {
> "params": {
> "param1": 2,
> "param2": 3.1
> },
> "script": "_score * doc['design.CLICKS'].value / pow(param1,
> param2)"
> }
> }
> }
> }
>
> Cheers,
> Luiz Guilherme
>
>
> On Thu, Apr 3, 2014 at 5:03 PM, Srinivasan Ramaswamy
> <[email protected]<javascript:>
> > wrote:
>
>> Hi
>>
>> I just started playing around with elastic search and I am trying out the
>> examples in the website with my data. I am trying to get custom scoring
>> working. I am following the example from
>> http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/query-dsl-function-score-query.html
>>
>> But unable to get the example working
>>
>> {
>> "query" : {
>> "function_score": {
>> "boost_mode": "replace",
>> "query": {"design.PRODUCT_DESC":"cool"},
>> "script_score": {
>> "params": {
>> "param1": 2,
>> "param2": 3.1
>> },
>> "script": "_score * doc['design.CLICKS'].value / pow(param1,
>> param2)"
>> }
>> }
>> }
>> }
>>
>> I tried this query and i get the error
>>
>> Caused by: org.elasticsearch.index.query.QueryParsingException: [designs]
>> [_na] query malformed, no field after start_object
>>
>> at
>> org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:216)
>>
>> at
>> org.elasticsearch.index.query.functionscore.FunctionScoreQueryParser.parse(FunctionScoreQueryParser.java:89)
>>
>> at
>> org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:223)
>>
>> at
>> org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:330)
>>
>> at
>> org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:260)
>>
>> at
>> org.elasticsearch.search.query.QueryParseElement.parse(QueryParseElement.java:33)
>>
>> at
>> org.elasticsearch.search.SearchService.parseSource(SearchService.java:622)
>>
>>
>> Any help would be appreciated.
>>
>> Thanks
>> Srini
>>
>> --
>> 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 [email protected] <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/elasticsearch/16a38015-eaed-45af-9ad3-c474521b81a8%40googlegroups.com<https://groups.google.com/d/msgid/elasticsearch/16a38015-eaed-45af-9ad3-c474521b81a8%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Luiz Guilherme P. Santos
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/6ae06fe2-2dfd-4a5c-920d-c2496c58c01b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.