Getting phrase count for each document separately


(Amit-3) #1

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+unsubscribe@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.


(system) #2