Re: elasticsearch Java API for function_score query

2014-06-12 Thread Jayanth Inakollu
Thanks a lot!! It works!!

On Wednesday, June 11, 2014 2:09:57 AM UTC+5:30, Jörg Prante wrote:
>
> Try this
>
> import org.elasticsearch.action.search.SearchRequest;
> import 
> org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder;
>
> import java.util.Arrays;
>
> import static org.elasticsearch.client.Requests.searchRequest;
> import static org.elasticsearch.index.query.FilterBuilders.termsFilter;
> import static org.elasticsearch.index.query.QueryBuilders.matchQuery;
> import static 
> org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders.factorFunction;
> import static 
> org.elasticsearch.search.builder.SearchSourceBuilder.searchSource;
>
> public class FunctionScoreTest {
>
> public void testFunctionScore() {
> SearchRequest searchRequest = searchRequest()
> .source(searchSource().query(new 
> FunctionScoreQueryBuilder(matchQuery("party_id", "12"))
> .add(termsFilter("course_cd", 
> Arrays.asList("writ100", "writ112", "writ113")), factorFunction(3.0f;
> }
> }
>
> Jörg
>
>
> On Tue, Jun 10, 2014 at 11:16 AM, Jayanth Inakollu  > wrote:
>
>> I need to implement the below function_score query using Java APIs. I 
>> couldn't find any official documentation for function_score query in the 
>> Java API section of elasticsearch
>>
>> "function_score": {
>> "functions": [
>> {
>> "boost_factor": "3",
>> "filter": {
>>  "terms" : {"course_cd" : ["writ100", "writ112", 
>> "writ113"] }   
>> }
>> }
>> ],
>> "query": {
>>   "match" : {
>>"party_id" : "12"
>>   }
>>  }
>> }
>>
>> Please help!
>>
>> -- 
>> 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 .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/elasticsearch/56d92aab-a4d7-4757-9441-f248c5296b3c%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/elasticsearch/56d92aab-a4d7-4757-9441-f248c5296b3c%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/a03661cb-5310-42ca-996d-e2e137376bb1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


elasticsearch Java API for function_score query

2014-06-10 Thread Jayanth Inakollu
I need to implement the below function_score query using Java APIs. I 
couldn't find any official documentation for function_score query in the 
Java API section of elasticsearch

"function_score": {
"functions": [
{
"boost_factor": "3",
"filter": {
 "terms" : {"course_cd" : ["writ100", "writ112", "writ113"] 
}   
}
}
],
"query": {
  "match" : {
   "party_id" : "12"
  }
 }
}

Please help!

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/56d92aab-a4d7-4757-9441-f248c5296b3c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.