I can see the use of that approach, and I agree that the behavior you
outline is probably closer to Google Suggest, but I am trying to basically
generate a set of results analogous to doing a match in a tag cloud. I'm
able to generate the tag cloud of terms using facets, but I can't figure out
how to filter the terms for a match against the user text.
For example, I have a lot of articles about animals. If the user type in
'do', I would like to return the most commonly indexed terms that start with
'do', such as ['dog', 'doberman', 'donut'].
On Wed, Sep 22, 2010 at 9:00 PM, Shay Banon email@example.com:
The way that I would implement a google suggest like capability is a bit
different. For every search a user enters, I would index it (into a separate
index) with the total_hits returned and the user text query (note that the
user text query can be only part of the actual query executed at the end
against elasticsearch, also this can be done completely in an async manner).
For example, index doc that looks like this:
"query" : "the user entered query",
"hits" : 345829304
Then, to provide the auto suggest, you can search that index, and do prefix
or more complex query on the "query" field, sorted by the hits or even use
custom_score query to get the score (how well it matches the "query"field),
and the hits into the picture. You can then also display the (expected) hits
associated with each result.
On Thu, Sep 23, 2010 at 2:41 AM, James Cook firstname.lastname@example.org wrote:
As the user enters characters into a search field, I want to find the
terms in my index that contain these characters. I am able to query to find
the terms, and I have tried several followup filters to try to limit this
list to those that start with the user entered characters, but no luck yet.
Does anyone know how I might craft this query?