Hi,

referencing 
http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/search-suggesters-completion.html
 
and 
http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/search-suggesters-completion.html
 
i tried to get suggests from middlewords without success.
Setup and Request:

#!/bin/bash

DOMAIN='127.0.0.1'
PORT='9200'
INDEX='music'
TYPE='song'

curl -X PUT $DOMAIN:$PORT/hotels -d '
{
  "mappings": {
    "hotel" : {
      "properties" : {
        "name" : { "type" : "string" },
        "city" : { "type" : "string" },
        "name_suggest" : {
          "type" :            "completion",
          "index_analyzer" :  "stop", # also tried standard, simple ...
          "search_analyzer" : "stop", # also tried standard, simple ...

          "preserve_position_increments": false,
          "preserve_separators": false
        }
      }
    }
  }
}'

curl -X PUT $DOMAIN:$PORT/hotels/hotel/1 -d '
{
  "name" :         "Mercure Hotel Munich",
  "city" :         "Munich",
  "name_suggest" : {
    "input" :      [
      "Mercure Hotel Munich",
      "Mercure Munich"
    ]
  }
}'

curl -X PUT $DOMAIN:$PORT/hotels/hotel/2 -d '
{
  "name" :         "Hotel Monaco",
  "city" :         "Munich",
  "name_suggest" : {
    "input" :      [
      "Monaco Munich",
      "Hotel Monaco"
    ]
  }
}'

curl -X PUT $DOMAIN:$PORT/hotels/hotel/3 -d '
{
  "name" :         "Courtyard by Marriot Munich City",
  "city" :         "Munich",
  "name_suggest" : {
    "input" :      [
      "Courtyard by Marriot Munich City",
      "Marriot Munich City"
    ]
  }
}'

curl -XPOST $DOMAIN:$PORT/hotels/_refresh

curl -X POST $DOMAIN:$PORT/hotels/_suggest?pretty -d '
{
  "hotels" : {
    "text" : "Munich",
    "completion" : {
      "field" : "name_suggest"
    }
  }
}'

Response:
{
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hotels" : [ {
    "text" : "Munich",
    "offset" : 0,
    "length" : 6,
    "options" : [ ]
  } ]
}

Any suggestions? Checked this against ES 1.3.2.

Thx in advance,
Tom

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/72f73b37-6432-4b61-82b9-2b078d956d3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to