Hi Vineeth, 

First of all, thank you for your suggestion.

BTW as you suggested, I can only able to get the no of matched documents. 
But what I need is the no of matches of the querystring in each field.

I can also make termquery for each field individually, as it would result 
in time consumption I dont want to that.

Could you help me out?

Thanks again.

Regards,
Anand

On Wednesday, 4 February 2015 18:58:35 UTC+5:30, vineeth mohan wrote:
>
> Hi , 
>
> There is a way to do it.
> You need to use the filter aggregation 
> <http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-filter-aggregation.html>
> .
>
> Keep 2 filters one for match on subject field and other on message field.
>
> {
>   "query": {
>     "multi_match": {
>       "query": "this is a test",
>       "fields": [
>         "subject",
>         "message"
>       ]
>     }
>   },
>   "aggs": {
>     "messageField": {
>       "filter": {
>         "query": {
>           "match": {
>             "message": "this is a test"
>           }
>         }
>       }
>     },
>     "subjectField": {
>       "filter": {
>         "query": {
>           "match": {
>             "subject": "this is a test"
>           }
>         }
>       }
>     }
>   }
> }
>
>
> Thanks
>            Vineeth Mohan,
>              Elasticsearch consultant,
>              qbox.io ( Elasticsearch service provider <http://qbox.io>)
>
>
> On Wed, Feb 4, 2015 at 6:44 PM, Anand kumar <[email protected] 
> <javascript:>> wrote:
>
>>
>> Hi all, 
>>
>>         Is it possible to get the query count per field, while querying 
>> via multi match query? 
>>
>>         {
>>              "multi_match" : {
>>                   "query":    "this is a test", 
>>                   "fields": [ "subject", "message" ] 
>>               }
>>         }
>>
>>        In above query, can i able to get the the no of matches from the 
>> subject field and message field, is there any other way to make it? 
>>
>>        Any suggestion would be helpful.
>>
>>        Thanks in advance.
>>
>>
>>  -- 
>> 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/13ddfd94-ed9b-4fda-a768-fcd21c14fc37%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/elasticsearch/13ddfd94-ed9b-4fda-a768-fcd21c14fc37%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/e2fa7b1b-7720-4e94-885a-12f62b0cd0f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to