After days of reading ... i'm still confused and need some help setting up 
an autocomplete function.

My intention is to provide search suggestions (as-you-type) to a twitter 
typeahead search box. So this means i don't want to return actual documents 
but ranked suggestion instead. The three suggesters seem to target exactly 
that so i thought to try the phrase suggester.

{
  "accoms_unittest" : {
    "settings" : {
      "index" : {
        "uuid" : "t6hW60RoSmyS7sf8_GBrwg",
        "analysis" : {
          "filter" : {
            "filter_shingle" : {
              "type" : "shingle",
              "min_shingle_size" : "1",
              "max_shingle_size" : "4",
              "output_unigrams" : "true"
            }
          },
          "analyzer" : {
            "shingle_analyzer" : {
              "type" : "custom",
              "filter" : [ "standard", "lowercase", "filter_shingle" ],
              "tokenizer" : "standard"
            }
          }
        },
        "number_of_replicas" : "1",
        "number_of_shards" : "5",
        "version" : {
          "created" : "1000299"
        }
      }
    }
  }
}


{
  "accoms_unittest" : {
    "mappings" : {
      "modelresult" : {
        "_boost" : {
          "name" : "boost",
          "null_value" : 1.0
        },
        "properties" : {

<...>
          "text_nl" : {
            "type" : "string",
            "store" : true,
            "term_vector" : "with_positions_offsets",
            "analyzer" : "snowball"
          },
          "text_suggest_nl" : {
            "type" : "string",
            "store" : true,
            "term_vector" : "with_positions_offsets",
            "analyzer" : "shingle_analyzer"
          },
        }
      }
    }
  }
}


GET accoms_unittest/_search
{
  "query": {
    "match_all": {}
  },
  "suggest": {
    "text": "levendige kleu",
    "simple_phrase" : {
      "phrase": {
        "field": "text_suggest_nl",
        "size": 5,
        "analyzer": "standard",
        "real_word_error_likelihood": 0.95,
        "max_errors": 1,
        "gram_size": 4,
        "direct_generator" : [ {
          "field" : "text_nl",
          "suggest_mode" : "always",
          "min_word_len" : 1
        } ]
      }
      
      
    }
  },
  "from": 0,
  "size": 0
}

{
   "took": 8,
   "timed_out": false,
   "_shards": {
      "total": 5,
      "successful": 5,
      "failed": 0
   },
   "hits": {
      "total": 12,
      "max_score": 0,
      "hits": []
   },
   "suggest": {
      "simple_phrase": [
         {
            "text": "levendige kleu",
            "offset": 0,
            "length": 14,
            "options": []
         }
      ]
   }
}


I know one of the objects has following input text: "De levendige kleuren en de 
etc...", so i run following search experiments:

"text": "levendige kleure" yields a suggestion "levendige kleuren" with score: 
2854.164

"text": "levendig kleure" yields no results?

"text": "levendi" also yields no suggestions?


Obviously when a user starts typing i would like to see a suggestion like 
"levendige" based on input search text "lev".


What am i missing here?


- is this the way to go?

- 


Paul Bormans


-- 
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/2ed471f3-bf44-4b05-911e-f5540f9f5fb2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to