Hi,
I like ElasticSearch so far, nice job!
I am indexing what I call Items under a single index called items, a
default index with default config. So I add items like this:
{
"name" : "Steak"
"description" : "yummy"
}
Suppose I've added 1000 items, 300 with the name "Steak", 200 with the
name "Steak Sandwich" and then 500 random names involving the word
Steak.
If I do a simple search like http://localhost:9200/items/_search?q=steak&size=100
I get at list like the following:
{
{
# "_index": "items",
# "_type": "document",
# "_id": "41ae5059a28b4838ad3bbc19f84610ba",
# "_score": 2.1778517,
#
-
"_source": {
* "id":
"41ae5059a28b4838ad3bbc19f84610ba",
* "name": "Steak",
* "description": "\n"
}
},
.... A WHOLE BUNCH OF "name" : "Steak" ...
{
# "_index": "items",
# "_type": "document",
# "_id": "f7c714f8b66f4854884379c3a954e4f6",
# "_score": 2.1087837,
#
-
"_source": {
* "id":
"f7c714f8b66f4854884379c3a954e4f6",
* "name": "Steak Encebollado",
* "description": "Steak with onions.\n"
}
},
This is not what I need for search suggestions. I basically want "the
set of all distinct names with the word Steak in them". In other
words, even if there are 300 documents with the name "Steak" I only
want the exact name "Steak" to be returned once. I want to see all
the variations of names that contain the word "Steak" exactly once.
How do I do that? I don't want to do it client side, so I want the
limit parameter to mean "return 100 distinct variations of the name
Steak".
Is this possible? Is it efficient?
Thanks,
Joel