What result do you get ?? 

Could you explain what do you try to achieve please ?? 



On Monday, March 16, 2015 at 10:03:43 PM UTC, satheesh kumar wrote:
>
> Hi Jaroslaw,
> This is the code for second query.
> BoolQueryBuilder boolQuery = QueryBuilders
>                     .boolQuery()
>                     .must(QueryBuilders.matchQuery("user._id",
>                             id).operator(MatchQueryBuilder.Operator.AND))
>                     .must(QueryBuilders.matchQuery(
>                             "user._parentId", parentId)
>                             .operator(MatchQueryBuilder.Operator.AND))
>                     .must(QueryBuilders.matchQuery(
>                             "user._type",
>                             "user").operator(
>                             MatchQueryBuilder.Operator.AND))
>                     .must(QueryBuilders.matchQuery(
>                             "user._deleted", false)
>                             .operator(MatchQueryBuilder.Operator.AND));
>
> On Monday, March 16, 2015 at 5:32:00 PM UTC-4, Jaroslaw Zawila wrote:
>>
>> Could you post how do you construct second query ??
>>
>> On Monday, March 16, 2015 at 6:03:21 PM UTC, satheesh kumar wrote:
>>>
>>> Hi,
>>>
>>> I'm trying to use Count API to see whether a search query returns data 
>>> count 1 or not.
>>>
>>>
>>> http://www.elastic.co/guide/en/elasticsearch/client/java-api/current/count.html
>>>  
>>> The above example uses single (fieldname, fieldvalue) which works as 
>>> expected.
>>>
>>> If I use TermQueryBuilder  with single (fieldname, fieldvalue) like the 
>>> below code it works.
>>> TermQueryBuilder termQueryBuilder = QueryBuilders.termQuery("user._id", 
>>> "5506dc497179fa070d31ce37");
>>>
>>> CountResponse response = 
>>> elasticSearchConnectionFactory.getConnection().prepareCount("test")
>>>                     .setQuery(termQueryBuilder )
>>>                     .execute()
>>>                     .actionGet();
>>>
>>> I've a condition with multiple fields and I expect to return count = 1
>>> ("user._id", "5506dc497179fa070d31(ce37")
>>> ("user.parentId", "5506dc497179fa070d31ce36")
>>> ("user.type", "user")
>>> ("user._deleted", "false")
>>>
>>> When I construct a boolean query for the above fields and try to pass 
>>> them to the below code, it doesn't work.
>>> CountResponse response = 
>>> elasticSearchConnectionFactory.getConnection().prepareCount("test")
>>>                     .setQuery(boolQuery)
>>>                     .execute()
>>>                     .actionGet();
>>>
>>>
>>> Can anyone suggest me how to achieve this?
>>>
>>>
>>> Thanks,
>>> Sat
>>>
>>

-- 
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/dd927a9b-6e5a-4b12-9c50-3c28e8210e42%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to