Hi Hiro,

I think you should use script term statistics.
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-advanced-scripting.html#_term_statistics

I post sample json and query DSL to gist.
https://gist.github.com/johtani/8818938

Note: Term “Java” is indexed just “java”, because standard analyzer use 
lowercase_filter.
          My sample script use “java” not “Java”. 

I am hoping that it will be helpful for you.

Regards
------------
Jun Ohtani
[email protected]
blog : http://blog.johtani.info
twitter : http://twitter.com/johtani

2014/01/28 15:54、Hiro Gangwani <[email protected]> のメール:

> Hi,
> We are indexing PDF, Word document in ES using attachment as type. Text based 
> search is implemented using QueryBuilder and field query.Is it possible to 
> get the count of words as defined in the search criteria for each results 
> returned.
> 
> For example:
> Document A contain Java key word 50 times and Document B contains Java key 
> word 30 times.
> When search criteria is "Java" and text based search is executed we get 2 
> documents in search results.
> Is it possible to get count of Java in document A and document B?
> I have used Term facets which just given count of documents where Java text 
> is defined. In this case only 2. What we need is count of Java word in each 
> document returned in result.
> 
> We are stuck up with this requirement and unable to find the solution for 
> this. Any help for this issue is appreciated and thanks in advance.
> 
> Hiro
> 
> -- 
> 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/73629eee-7b58-44d4-87b3-aeb0d18b4c03%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to