Does anyone know of a way to get elasticsearch to return a word count?


(Nik Everett) #1

It looks like my user interface returns a word count and it was sneakily
implemented by faulting text in from the database and running
str_word_count on it. I'd rather have elasticsearch calculate the number
of words in my text so I don't have to load to show search results. Does
anyone know a good way to do that? I assume it'd make more sense to store
the word count on index into another field and just fetch it.

Nik

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(simonw-2) #2

can you go a bit more into detail here? are you asking for the frequency of
a word across the entire index or within a document? How do you need to
select words?

simon

On Thursday, October 10, 2013 11:52:04 PM UTC+2, Nikolas Everett wrote:

It looks like my user interface returns a word count and it was sneakily
implemented by faulting text in from the database and running
str_word_count on it. I'd rather have elasticsearch calculate the number
of words in my text so I don't have to load to show search results. Does
anyone know a good way to do that? I assume it'd make more sense to store
the word count on index into another field and just fetch it.

Nik

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(Nik Everett) #3

Just the number of terms in some field in the document. It is is a field I both query and highlight. I'd be happy with something approximate. I saw today I might be able to do a bit of math on the field norm to get it.

Sent from my iPhone

On Oct 11, 2013, at 5:17 PM, simonw simon.willnauer@elasticsearch.com wrote:

can you go a bit more into detail here? are you asking for the frequency of a word across the entire index or within a document? How do you need to select words?

simon

On Thursday, October 10, 2013 11:52:04 PM UTC+2, Nikolas Everett wrote:
It looks like my user interface returns a word count and it was sneakily implemented by faulting text in from the database and running str_word_count on it. I'd rather have elasticsearch calculate the number of words in my text so I don't have to load to show search results. Does anyone know a good way to do that? I assume it'd make more sense to store the word count on index into another field and just fetch it.

Nik

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(simonw-2) #4

the field norm might help but it's hard to access and it's a 8bit float
value that includes the boosts so it might be quite lossy? What you could
do in master is using a TermVector and consume the field in the client
since it contains all terms for a field in a document.

On Friday, October 11, 2013 11:25:54 PM UTC+2, Nikolas Everett wrote:

Just the number of terms in some field in the document. It is is a field I
both query and highlight. I'd be happy with something approximate. I saw
today I might be able to do a bit of math on the field norm to get it.

Sent from my iPhone

On Oct 11, 2013, at 5:17 PM, simonw <simon.w...@elasticsearch.com<javascript:>>
wrote:

can you go a bit more into detail here? are you asking for the frequency
of a word across the entire index or within a document? How do you need to
select words?

simon

On Thursday, October 10, 2013 11:52:04 PM UTC+2, Nikolas Everett wrote:

It looks like my user interface returns a word count and it was sneakily
implemented by faulting text in from the database and running
str_word_count on it. I'd rather have elasticsearch calculate the number
of words in my text so I don't have to load to show search results. Does
anyone know a good way to do that? I assume it'd make more sense to store
the word count on index into another field and just fetch it.

Nik

--
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 elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #5