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]>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].
> 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/CAMdL%3DZGr12cwOJ_3DXUfPFefn_jmWhbj95wXw%3D2UZVQiZkTE1Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to