How to get the count of matched search term in all the fields in each resulting document

Hello,

We have a web application, where we are providing a global search feature
through Elasticsearch. One can use this feature to search any text across
all the documents (and on all fields). We are using '_all' in fields while
querying elastic search. This yields us the desired results perfectly.
Below is the sense example.
{
"query": {
"query_string": {
"query": anysearchterm,
"fields": [ "_all" ]
}
}
}

Now what we want next is the precise relevance of the search result. We
want to know,* in which all fields, within each of the resulting document,
did elastic search found the match for the search term*. Thus we want to
know the occurrence of the search term, with respect to individual fields,
for all the resulting documents.

We have been searching for this for quiet some time. We have tried 'explain'
option while querying, but this does not give field specific count of the
search term.

Any kind of help is highly appreciated. We would be really greatfull if
anybody can put some insights on this.

Thank you,
Manoj

--
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/8ce38b12-f6c3-4ffb-b32c-64a6c738bc20%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hello Manoj ,

The explain might give what you are looking for , but i need to look into
it.
Have you tried highlighting for this ?
You can go through the number of fragments or number of highlighted terms
to find this.

Anyway following will yield you the result -
{
"script_fields": {
"test1": {
"script": "_index['message']['term'].tf()"
}
}
}

Thanks
Vineeth

On Tue, Aug 26, 2014 at 11:10 AM, Manoj Acharya manoj.acharya15@gmail.com
wrote:

Hello,

We have a web application, where we are providing a global search feature
through Elasticsearch. One can use this feature to search any text across
all the documents (and on all fields). We are using '_all' in fields while
querying Elasticsearch. This yields us the desired results perfectly.
Below is the sense example.
{
"query": {
"query_string": {
"query": anysearchterm,
"fields": [ "_all" ]
}
}
}

Now what we want next is the precise relevance of the search result. We
want to know,* in which all fields, within each of the resulting
document, did Elasticsearch found the match for the search term*. Thus
we want to know the occurrence of the search term, with respect to
individual fields
, for all the resulting documents.

We have been searching for this for quiet some time. We have tried
'explain' option while querying, but this does not give field specific
count of the search term.

Any kind of help is highly appreciated. We would be really greatfull if
anybody can put some insights on this.

Thank you,
Manoj

--
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/8ce38b12-f6c3-4ffb-b32c-64a6c738bc20%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/8ce38b12-f6c3-4ffb-b32c-64a6c738bc20%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGdPd5mAynB84MWUe7ZQBidufi3Qu5TYqnhV%2BGLLN0VzcNowqg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.