cching
(Craig Ching)
February 1, 2015, 5:12pm
1
Hi,
I'm trying to implement the "search as you type" example
from http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/_index_time_search_as_you_type.html
Can someone see what I'm doing wrong?
curl -XDELETE localhost:9200/my_index
echo
curl -XPUT localhost:9200/my_index -d '
{
"settings": {
"number_of_shards": 1,
"analysis": {
"filter": {
"autocomplete_filter": {
"type": "edge_ngram",
"min_gram": 1,
"max_gram": 20
}
},
"analyzer": {
"autocomplete": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"autocomplete_filter"
]
}
}
}
}
}'
echo
curl -XPUT localhost:9200/my_index/_mapping/my_type -d '
{
"my_type": {
"properties": {
"name": {
"type": "string",
"analyzer": "autocomplete"
}
}
}
}'
echo
curl localhost:9200/my_index/my_type/_bulk -d '
{ "index": { "_id": 1 }}
{ "name": "Brown foxes" }
{ "index": { "_id": 2 }}
{ "name": "Yellow furballs" }
'
echo
curl localhost:9200/my_index/my_type/_search -d '
{
"query": {
"match": {
"name": "brown fo"
}
}
}'
echo
curl localhost:9200/my_index/my_type/_validate/query?explain -d '
{
"query": {
"match": {
"name": "brown fo"
}
}
}'
echo
curl localhost:9200/my_index/my_type/_search -d '
{
"query": {
"match": {
"name": {
"query": "brown fo",
"analyzer": "standard"
}
}
}
}'
echo
curl localhost:9200/my_index/my_type/_validate/query?explain -d '
{
"query": {
"match": {
"name": {
"query": "brown fo",
"analyzer": "standard"
}
}
}
}'
echo
--
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 .
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/3265ddb0-eab4-4cc7-9fc0-66ae56c358e5%40googlegroups.com .
For more options, visit https://groups.google.com/d/optout .
cching
(Craig Ching)
February 1, 2015, 5:14pm
2
Sorry, I should also explain the problem
For both of the searches I'm getting the following:
{"took":1,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},
"hits":{"total":0,"max_score":null,"hits": }}
On Sunday, February 1, 2015 at 11:12:55 AM UTC-6, Craig Ching wrote:
Hi,
I'm trying to implement the "search as you type" example from
Elasticsearch Platform — Find real-time answers at scale | Elastic
Can someone see what I'm doing wrong?
curl -XDELETE localhost:9200/my_index
echo
curl -XPUT localhost:9200/my_index -d '
{
"settings": {
"number_of_shards": 1,
"analysis": {
"filter": {
"autocomplete_filter": {
"type": "edge_ngram",
"min_gram": 1,
"max_gram": 20
}
},
"analyzer": {
"autocomplete": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"autocomplete_filter"
]
}
}
}
}
}'
echo
curl -XPUT localhost:9200/my_index/_mapping/my_type -d '
{
"my_type": {
"properties": {
"name": {
"type": "string",
"analyzer": "autocomplete"
}
}
}
}'
echo
curl localhost:9200/my_index/my_type/_bulk -d '
{ "index": { "_id": 1 }}
{ "name": "Brown foxes" }
{ "index": { "_id": 2 }}
{ "name": "Yellow furballs" }
'
echo
curl localhost:9200/my_index/my_type/_search -d '
{
"query": {
"match": {
"name": "brown fo"
}
}
}'
echo
curl localhost:9200/my_index/my_type/_validate/query?explain -d '
{
"query": {
"match": {
"name": "brown fo"
}
}
}'
echo
curl localhost:9200/my_index/my_type/_search -d '
{
"query": {
"match": {
"name": {
"query": "brown fo",
"analyzer": "standard"
}
}
}
}'
echo
curl localhost:9200/my_index/my_type/_validate/query?explain -d '
{
"query": {
"match": {
"name": {
"query": "brown fo",
"analyzer": "standard"
}
}
}
}'
echo
--
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 .
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/ce82bc0d-e0a4-485f-bdec-09b93a7456fb%40googlegroups.com .
For more options, visit https://groups.google.com/d/optout .
For implementing good autocomplete I recommend you look at the completion
suggester - its much faster and has more capabilities. It was built
especially for that.
See Elasticsearch Platform — Find real-time answers at scale | Elastic and
Elasticsearch Platform — Find real-time answers at scale | Elastic
You can then complement it with Phrase Suggester to recommend spelling
corrections etc
edge-grams are less than ideal for this use case given the above tools
--
Itamar Syn-Hershko
http://code972.com | @synhershko https://twitter.com/synhershko
Freelance Developer & Consultant
Lucene.NET committer and PMC member
On Sun, Feb 1, 2015 at 7:12 PM, Craig Ching craigching@gmail.com wrote:
Hi,
I'm trying to implement the "search as you type" example from
Elasticsearch Platform — Find real-time answers at scale | Elastic
Can someone see what I'm doing wrong?
curl -XDELETE localhost:9200/my_index
echo
curl -XPUT localhost:9200/my_index -d '
{
"settings": {
"number_of_shards": 1,
"analysis": {
"filter": {
"autocomplete_filter": {
"type": "edge_ngram",
"min_gram": 1,
"max_gram": 20
}
},
"analyzer": {
"autocomplete": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"autocomplete_filter"
]
}
}
}
}
}'
echo
curl -XPUT localhost:9200/my_index/_mapping/my_type -d '
{
"my_type": {
"properties": {
"name": {
"type": "string",
"analyzer": "autocomplete"
}
}
}
}'
echo
curl localhost:9200/my_index/my_type/_bulk -d '
{ "index": { "_id": 1 }}
{ "name": "Brown foxes" }
{ "index": { "_id": 2 }}
{ "name": "Yellow furballs" }
'
echo
curl localhost:9200/my_index/my_type/_search -d '
{
"query": {
"match": {
"name": "brown fo"
}
}
}'
echo
curl localhost:9200/my_index/my_type/_validate/query?explain -d '
{
"query": {
"match": {
"name": "brown fo"
}
}
}'
echo
curl localhost:9200/my_index/my_type/_search -d '
{
"query": {
"match": {
"name": {
"query": "brown fo",
"analyzer": "standard"
}
}
}
}'
echo
curl localhost:9200/my_index/my_type/_validate/query?explain -d '
{
"query": {
"match": {
"name": {
"query": "brown fo",
"analyzer": "standard"
}
}
}
}'
echo
--
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 .
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/3265ddb0-eab4-4cc7-9fc0-66ae56c358e5%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/3265ddb0-eab4-4cc7-9fc0-66ae56c358e5%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout .
--
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 .
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAHTr4ZvjP1CsF9JSs1H0u6fioT_igm%3DBMxWfYs3iY2A5M6SXJw%40mail.gmail.com .
For more options, visit https://groups.google.com/d/optout .
cching
(Craig Ching)
February 1, 2015, 5:20pm
4
That's fine, but I still want to know what I'm doing wrong in my example
(taken pretty much verbatim from the link provided).
That said, I am planning on evaluating both for my use case. The problem I
have with the suggester is the duplication. That said, I'd rather not
debate that right now as I've not even really looked into it yet
On Sunday, February 1, 2015 at 11:16:42 AM UTC-6, Itamar Syn-Hershko wrote:
For implementing good autocomplete I recommend you look at the completion
suggester - its much faster and has more capabilities. It was built
especially for that.
See Elasticsearch Platform — Find real-time answers at scale | Elastic and
Elasticsearch Platform — Find real-time answers at scale | Elastic
You can then complement it with Phrase Suggester to recommend spelling
corrections etc
edge-grams are less than ideal for this use case given the above tools
--
Itamar Syn-Hershko
http://code972.com | @synhershko https://twitter.com/synhershko
Freelance Developer & Consultant
Lucene.NET committer and PMC member
On Sun, Feb 1, 2015 at 7:12 PM, Craig Ching <craig...@gmail.com
<javascript:>> wrote:
Hi,
I'm trying to implement the "search as you type" example from
Elasticsearch Platform — Find real-time answers at scale | Elastic
Can someone see what I'm doing wrong?
curl -XDELETE localhost:9200/my_index
echo
curl -XPUT localhost:9200/my_index -d '
{
"settings": {
"number_of_shards": 1,
"analysis": {
"filter": {
"autocomplete_filter": {
"type": "edge_ngram",
"min_gram": 1,
"max_gram": 20
}
},
"analyzer": {
"autocomplete": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"autocomplete_filter"
]
}
}
}
}
}'
echo
curl -XPUT localhost:9200/my_index/_mapping/my_type -d '
{
"my_type": {
"properties": {
"name": {
"type": "string",
"analyzer": "autocomplete"
}
}
}
}'
echo
curl localhost:9200/my_index/my_type/_bulk -d '
{ "index": { "_id": 1 }}
{ "name": "Brown foxes" }
{ "index": { "_id": 2 }}
{ "name": "Yellow furballs" }
'
echo
curl localhost:9200/my_index/my_type/_search -d '
{
"query": {
"match": {
"name": "brown fo"
}
}
}'
echo
curl localhost:9200/my_index/my_type/_validate/query?explain -d '
{
"query": {
"match": {
"name": "brown fo"
}
}
}'
echo
curl localhost:9200/my_index/my_type/_search -d '
{
"query": {
"match": {
"name": {
"query": "brown fo",
"analyzer": "standard"
}
}
}
}'
echo
curl localhost:9200/my_index/my_type/_validate/query?explain -d '
{
"query": {
"match": {
"name": {
"query": "brown fo",
"analyzer": "standard"
}
}
}
}'
echo
--
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:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/3265ddb0-eab4-4cc7-9fc0-66ae56c358e5%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/3265ddb0-eab4-4cc7-9fc0-66ae56c358e5%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout .
--
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 .
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/f6f5aa6e-a7f1-4d43-af08-95a16bfa9f1a%40googlegroups.com .
For more options, visit https://groups.google.com/d/optout .