Hi All,
I am new to ElasticSearch and currently I am using ElasticSearch to connect
to MongoDB for indexing and searching. I would like to implement keyword
auto-complete feature like search engines which provide a list of
suggestion keyword when user key in partial keywords. I had a document
which contains many fields and I only want the auto-complete keyword to
search on 4 fields (title, description, category and sub-category) . Below
is the index that I am creating:
curl -XPUT http://localhost:9200/testindex -d '
{
- "settings": {*
-
"analysis":{* -
"filter":{* -
"edge_nGram_filter":{* -
"type":"edgeNGram",* -
"min_gram": 1,* -
"max_gram": 50,* -
"token_chars": [* -
"letter",* -
"digit",* -
"punctuation",* -
"symbol"* -
]* -
}* -
},* -
"analyzer": {* -
"edge_nGram_analyzer": {* -
"type": "custom",* -
"tokenizer": "whitespace",* -
"filter": [* -
"lowercase",* -
"asciifolding",* -
"edge_nGram_filter"* -
]* -
},* -
"whitespace_analyzer": {* -
"type": "custom",* -
"tokenizer": "whitespace",* -
"filter": [* -
"lowercase",* -
"asciifolding"* -
]* -
}* -
}* -
}* - },*
- "mappings" : {*
-
"Merchant" : {* -
"_all": {* -
"index_analyzer": "edge_nGram_analyzer",* -
"search_analyzer": "whitespace_analyzer"* -
},* -
"properties" : {* -
"screenNm": {* -
"type": "string",* -
"index": "no",* -
"include_in_all": false* -
},* -
"categoryId": {* -
"type": "long", * -
"index": "no",* -
"include_in_all": false* -
},* -
"title": {* -
"type": "string",* -
"index": "not_analyzed"* -
},* -
"desc": {* -
"type": "string",* -
"index": "not_analyzed"* -
},* -
"index": "no", "include_in_all": false },"email": { "type": "string",
"createdAt": { "format": "dateOptionalTime",
"type": "date", "index": "no",
"include_in_all": false },
"subCategoryList": {* -
"properties" : {* -
"subCategoryId": {* -
"type": "long", * -
"index": "no",* -
"include_in_all": false* -
},* -
"subCategory": {* -
"type": "string",* -
"index": "not_analyzed"* -
}* -
}* -
},* -
"category": {* -
"type": "string",* -
"index": "not_analyzed"* -
}* -
}* -
}* - }*
}'
Below is my questions and I am hoping some of you could shed me some lights:
-
When I perform match query search on "_all" fields for keyword "food"
(I had set the returned record size to 6), I will get 6 documents which
match the *food *keyword in either of the fields (title, description,
category and sub-category). Result example as the following:• title=FoodPandaToyShop, description=Desc1, category=toy,
sub-category=kids
• title=Restaurant B, description=Desc2, category=foodcategoryA,
sub-category=dairy
• title=Restaurant B, description=Desc3, category= foodcategoryB,
sub-category=dairy
• title=Restaurant B, description=Desc4, category= foodcategoryC,
sub-category=dairy
• title=Restaurant B, description=Desc5, category= foodcategoryD,
sub-category=dairySo the list of string that we want are FoodPandaToyShop,
foodcategoryA, foodcategoryB, foodcategoryC, foodcategoryD. We need to
find a way to massage the data because we will received document back from
ElasticSearch instead of text string. Is there a way to get the text
instead of the whole document?? -
Can we perform my scenario using completion suggester?? As I need to
perform search on multiple fields. -
Is performance a issue if I am using edgeNGram on large documents set?
Appreciate your help. Thanks a lot !!!
Regards,
CYea
--
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/3b2bd828-02c4-4899-a615-2a773b6d671a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.