I am trying since many day to build a simple demo autocomplete search form. I'm using javascript and typeahead.js library.
I have a probleme to get all of them working together. I am using Elasticsearch service from amazon web services.
When i type the first letter of the word am searching, the form doesn't suggest a list of words indexed in my cluster which start with the letter entered.
I read the Completion suggester documentation but i don't understand how i can query completion suggester by using javascript.
Here is my code :
$('#remote .typeahead').typeahead({
highlight: true,
},
{
source: function(query, process){
$.ajax({
url:'https://xxxxxxxxxxxxxxx.es.amazonaws.com/xxxxxxxxx/_search',
type:'GET',
data:'q=' + query,
dataType:'JSON',
async:true,
success: function(data){
console.log(data);
}
})
}
})
When i type the "g" in the search file i get this result in the browser console log:
{"took":1,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}
Whereas there are several words starting with a "g" in my cluster.
What am i doing wrong ?
Thanks for helping.
