elasticsearch-suggest-plugin icon indicating copy to clipboard operation
elasticsearch-suggest-plugin copied to clipboard

How to get suggest from few fields?

Open lzerma opened this issue 10 years ago • 5 comments

Hi, I need get all suggestions from my document, but I don't know how set multiple fields.

Ex 1 - This working fine, but is not suggest all document properties:

curl -XPOST "http://localhost:9200/index/type/__suggest" -d'
{
  "field": "category_name",
  "term": "c",
  "size": "10",
  "type": "fuzzy",
   "analyzer" : "standard"
}' 

I Need something like this:

curl -XPOST "http://localhost:9200/index/type/__suggest" -d'
{
  "fields": {
    "category_name": "value",
    "other properties": "another value",
},
  ...
}' 

Thank you.

lzerma avatar Apr 28 '14 17:04 lzerma

what about executing several suggest requests?

spinscale avatar Apr 29 '14 02:04 spinscale

I don't did try the second example. This works?

lzerma avatar Apr 29 '14 02:04 lzerma

I was talking about two separate requests. If this is not what you want please explain it differently, its not very clear then to me. Thanks!

spinscale avatar Apr 29 '14 02:04 spinscale

Hi,

Sorry for the last comments, I was very confused.

Ok, How I can, in one call to curl -XPOST "http://localhost:9200/index/type/__suggest" -d' get the full document instead few suggests terms. So in one call to suggest plugin I can get the documents suggest.

Request: curl -X POST localhost:9200/cars/car/__suggest -d '{ "field" : "name", "type": "full", "term" : "b", "analyzer" : "standard" }'

Response: {"suggestions":["FULL DOCUMENT HERE","ANOTHER FULL DOCUMENT HERE"],"_shards":{"total":5,"successful":5,"failed":0}}

lzerma avatar Aug 13 '14 19:08 lzerma

@lzerma that is not possible with this plugin. You could use the official completion suggester and payloads though in order to implement this... See http://www.elasticsearch.org/blog/you-complete-me/

spinscale avatar Aug 14 '14 07:08 spinscale