I'm trying to understand how Text Query works. My goal is to make an
autocomplete/suggest feature. As below, I insert documents with the
"title" fields: "quick brown", "quick brown fox", "quiet brow" which
is analyzed with standard analyzer. I'm trying the Text Query with
phrase_prefix (http://www.elasticsearch.org/guide/reference/query-dsl/
text-query.html) pretty much exactly as described in the guide, but
I'm getting no hits with any query I'm using. For example, for "quick
brown" I would expect to see 2 hits: "quick brown" and "quick brown
fox".
What am I doing wrong? Is there a better analyzer/query setup I
should be using for an autocomplete kind of use case?
Cheers,
LTVP
On Feb 6, 2012, at 9:41 AM, quain wrote:
I'm trying to understand how Text Query works. My goal is to make an
autocomplete/suggest feature. As below, I insert documents with the
"title" fields: "quick brown", "quick brown fox", "quiet brow" which
is analyzed with standard analyzer. I'm trying the Text Query with
phrase_prefix (Elasticsearch Platform — Find real-time answers at scale | Elastic
text-query.html) pretty much exactly as described in the guide, but
I'm getting no hits with any query I'm using. For example, for "quick
brown" I would expect to see 2 hits: "quick brown" and "quick brown
fox".
What am I doing wrong? Is there a better analyzer/query setup I
should be using for an autocomplete kind of use case?
Cheers,
LTVP
On Feb 6, 2012, at 9:41 AM, quain wrote:
I'm trying to understand how Text Query works. My goal is to make an
autocomplete/suggest feature. As below, I insert documents with the
"title" fields: "quick brown", "quick brown fox", "quiet brow" which
is analyzed with standard analyzer. I'm trying the Text Query with
phrase_prefix (Elasticsearch Platform — Find real-time answers at scale | Elastic
text-query.html) pretty much exactly as described in the guide, but
I'm getting no hits with any query I'm using. For example, for "quick
brown" I would expect to see 2 hits: "quick brown" and "quick brown
fox".
What am I doing wrong? Is there a better analyzer/query setup I
should be using for an autocomplete kind of use case?
A followup question. Is there a way to prefer results that have the
phrase at the beginning? For example, if I'm searching for "quick
brown" to prefer "quick brown fox" over "fox quick brown", etc?
I am looking at the docs. and it seems like you can set a boost to
certain results. How can I structure something like this to do what I
want with a phrase_prefix text query?
Cheers,
LTVP
On Feb 6, 2012, at 9:41 AM, quain wrote:
I'm trying to understand how Text Query works. My goal is to make an
autocomplete/suggest feature. As below, I insert documents with the
"title" fields: "quick brown", "quick brown fox", "quiet brow" which
is analyzed with standard analyzer. I'm trying the Text Query with
phrase_prefix (Elasticsearch Platform — Find real-time answers at scale | Elastic
text-query.html) pretty much exactly as described in the guide, but
I'm getting no hits with any query I'm using. For example, for "quick
brown" I would expect to see 2 hits: "quick brown" and "quick brown
fox".
What am I doing wrong? Is there a better analyzer/query setup I
should be using for an autocomplete kind of use case?
There isn't an option to only restrict it to text at the beginning of the relevant field data.
On Tuesday, February 7, 2012 at 12:33 AM, quain wrote:
A followup question. Is there a way to prefer results that have the
phrase at the beginning? For example, if I'm searching for "quick
brown" to prefer "quick brown fox" over "fox quick brown", etc?
I am looking at the docs. and it seems like you can set a boost to
certain results. How can I structure something like this to do what I
want with a phrase_prefix text query?
Cheers,
LTVP
On Feb 6, 2012, at 9:41 AM, quain wrote:
I'm trying to understand how Text Query works. My goal is to make an
autocomplete/suggest feature. As below, I insert documents with the
"title" fields: "quick brown", "quick brown fox", "quiet brow" which
is analyzed with standard analyzer. I'm trying the Text Query with
phrase_prefix (Elasticsearch Platform — Find real-time answers at scale | Elastic
text-query.html) pretty much exactly as described in the guide, but
I'm getting no hits with any query I'm using. For example, for "quick
brown" I would expect to see 2 hits: "quick brown" and "quick brown
fox".
What am I doing wrong? Is there a better analyzer/query setup I
should be using for an autocomplete kind of use case?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.