Hello Darren ,

If its term frequency of a word that you are looking for , you can use
script fields -

{
  "fields": [
    "text"
  ],
  "query": {
    "term": {
      "text": "god"
    }
  },
  "script_fields": {
    "tf": {
      "script": "_index['text']['god'].tf()"
    }
  }
}

SCRIPTING -
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-advanced-scripting.html
SCRIPT FIELDS -
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-script-fields.html#search-request-script-fields

Thanks
          Vineeth


On Fri, Sep 5, 2014 at 6:45 PM, vineeth mohan <[email protected]>
wrote:

> Hello Darren ,
>
> What do you mean by number of hits ?
> Is it the number of occurrence of a term in a document ?
>
> Thanks
>          Vineeth
>
>
>
>
> On Fri, Sep 5, 2014 at 6:32 PM, Darren Trzynka <[email protected]>
> wrote:
>
>> In our current application, it is important to know the number of times
>> hits were found within a document for a given search.  We are considering
>> using elasticsearch but this is one area I have yet to find a solution for
>> with elasticsearch.  The only thing I have found remotely possible is
>> getting the highlighted hits, then counting them.  This of course could be
>> rather time consuming possibly having to parse 1000s of documents just to
>> get the number of hits within a document.  The data is there of course
>> within elasticsearch as it is able to highlight the hits, I just need to
>> know how to get access to those hit numbers per document.
>>
>> --
>> 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/8e7a6b6c-a4c4-4d41-8fa4-035b19341c69%40googlegroups.com
>> <https://groups.google.com/d/msgid/elasticsearch/8e7a6b6c-a4c4-4d41-8fa4-035b19341c69%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/CAGdPd5mgG2Sh50A64FWCfZp7Abwa1qX_qs5k-qUx1pJowpp2uQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to