Getting phrase count for each document separately.

2014-04-18 Thread Amit
I would like to get a phrase count for every document.
I do not wish to run a query for every document, i would rather run one 
single query.

For example if i have the following documents:
{
   name : John,
   Message : The lion is *very *fast
}

{
  name : Ben,
  Message : The lion is *very very* fast
}

I would like to query my documents for the word *very* and get back 
something like this:
{
   name : John,
   Message : The lion is *very *fast,
  *score : 1*
}

{
  name : Ben,
  Message : The lion is *very very* fast,
  *score : 2*
}

I failed to find out how to do this so far. I only found queries that give 
the sum of phrase count of all documents together (in my example 3).
How can I do this using elastic search query?
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 elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/51e15537-cb1f-4e49-926e-6b2a6fce56b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Getting phrase count for each document separately.

2014-04-18 Thread Amit


I would like to get a phrase count for each document separately.
I do not wish to run a query for every document, i would rather run one 
single query.

For example if i have the following documents:
{
   name : John,
   message : The lion is *very **fast*
}

{
  name : Ben,
  message : The lion is *very **fast* and the bardelas is *very fast*


}

I would like to query my documents for the phrase *very fast* and get 
back something like this:
{
   name : John,
message : The lion is *very **fast*,
  *count : 1*

}

{
  name : Ben,
   message : The lion is *very **fast* and the bardelas is *very 
fast*,
  *count : 2*
}

I failed to find out how to do this so far. I only found queries that give 
the total number of documents that contain the phrase (in my example 2 
documents).
How can I do this using elastic search query?
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 elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/3f1aefe9-97fa-44ba-a4b1-644536bd2a5c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.