Hi guys!
I want to do something like this.
When I search for example on field first_name by wildcard "A" I want
to see my result sortable like this
Andrew
Frank
Michael
Brenda
Can I do this by the naitive tools of elastic search?
And second question
I have some not_analyzed string fields, and I try to search by this
fields on the 500 000 items on ES, and I have 2 second on my computer
that is not realy fast
What I need to do, to make it faster?
wildcard searches are going to be slow, especially when doing leading wildcards. You have several options:
Use text_phrase_prefix query (new in 0.16.1), where you can control the number of max_expansions to reduce the time it takes to query.
Use ngrams to try and provide different type of suggestions. That will need to be done by creating an analyzer for that, and defining it in the mappings. And then do a simple text query (both index text and search text will be analyzed and "ngrammed").
On Tuesday, May 24, 2011 at 9:32 PM, Michael wrote:
Hi guys!
I want to do something like this.
When I search for example on field first_name by wildcard "A" I want
to see my result sortable like this
Andrew
Frank
Michael
Brenda
Can I do this by the naitive tools of Elasticsearch?
And second question
I have some not_analyzed string fields, and I try to search by this
fields on the 500 000 items on ES, and I have 2 second on my computer
that is not realy fast
What I need to do, to make it faster?
wildcard searches are going to be slow, especially when doing leading
wildcards. You have several options:
Use text_phrase_prefix query (new in 0.16.1), where you can control the
number of max_expansions to reduce the time it takes to query.
Use ngrams to try and provide different type of suggestions. That will
need to be done by creating an analyzer for that, and defining it in the
mappings. And then do a simple text query (both index text and search text
will be analyzed and "ngrammed").
Does text_phrase_prefix query works on not analyzed fields? My tests show it
work like prefix when field is not analyzed:
For example:
The query {'query': {'text_phrase_prefix': {'fields.name': {'query': 'yuriy
os' } } } matched document with fields.name 'yuriy ostapyuk'
But the query {'query': {'text_phrase_prefix': {'fields.name': {'query':
'os' } } } doesn't match any documents.
Yes, it works on non analyzed fields, but then, the entire content is checked against as a single term. so you need to provide a full prefix. If you want the text to be "broken" down into more granular terms, then you need to have it analyzed.
On Friday, May 27, 2011 at 4:30 PM, Andrew Degtyarev wrote:
wildcard searches are going to be slow, especially when doing leading wildcards. You have several options:
Use text_phrase_prefix query (new in 0.16.1), where you can control the number of max_expansions to reduce the time it takes to query.
Use ngrams to try and provide different type of suggestions. That will need to be done by creating an analyzer for that, and defining it in the mappings. And then do a simple text query (both index text and search text will be analyzed and "ngrammed").
Does text_phrase_prefix query works on not analyzed fields? My tests show it work like prefix when field is not analyzed:
For example:
The query {'query': {'text_phrase_prefix': {'fields.name (http://fields.name)': {'query': 'yuriy os' } } } matched document with fields.name (http://fields.name) 'yuriy ostapyuk'
But the query {'query': {'text_phrase_prefix': {'fields.name (http://fields.name)': {'query': 'os' } } } doesn't match any documents.
Yes, it works on non analyzed fields, but then, the entire content is
checked against as a single term. so you need to provide a full prefix. If
you want the text to be "broken" down into more granular terms, then you
need to have it analyzed.
Hm...
Don't understand. Could you explain about "full prefix"?
On Friday, May 27, 2011 at 4:30 PM, Andrew Degtyarev wrote:
wildcard searches are going to be slow, especially when doing leading
wildcards. You have several options:
Use text_phrase_prefix query (new in 0.16.1), where you can control the
number of max_expansions to reduce the time it takes to query.
Use ngrams to try and provide different type of suggestions. That will
need to be done by creating an analyzer for that, and defining it in the
mappings. And then do a simple text query (both index text and search text
will be analyzed and "ngrammed").
Does text_phrase_prefix query works on not analyzed fields? My tests show
it work like prefix when field is not analyzed:
For example:
The query {'query': {'text_phrase_prefix': {'fields.name': {'query':
'yuriy os' } } } matched document with fields.name 'yuriy ostapyuk'
But the query {'query': {'text_phrase_prefix': {'fields.name': {'query':
'os' } } } doesn't match any documents.
Yes, it works on non analyzed fields, but then, the entire content is checked against as a single term. so you need to provide a full prefix. If you want the text to be "broken" down into more granular terms, then you need to have it analyzed.
Hm...
Don't understand. Could you explain about "full prefix"?
On Friday, May 27, 2011 at 4:30 PM, Andrew Degtyarev wrote:
wildcard searches are going to be slow, especially when doing leading wildcards. You have several options:
Use text_phrase_prefix query (new in 0.16.1), where you can control the number of max_expansions to reduce the time it takes to query.
Use ngrams to try and provide different type of suggestions. That will need to be done by creating an analyzer for that, and defining it in the mappings. And then do a simple text query (both index text and search text will be analyzed and "ngrammed").
Does text_phrase_prefix query works on not analyzed fields? My tests show it work like prefix when field is not analyzed:
For example:
The query {'query': {'text_phrase_prefix': {'fields.name (http://fields.name)': {'query': 'yuriy os' } } } matched document with fields.name (http://fields.name) 'yuriy ostapyuk'
But the query {'query': {'text_phrase_prefix': {'fields.name (http://fields.name)': {'query': 'os' } } } doesn't match any documents.
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.