Skip to content

Instantly share code, notes, and snippets.

@mattfield11
Created August 30, 2017 12:37
Show Gist options
  • Save mattfield11/ee7e44817751dcfc2ed119cb5a8b8534 to your computer and use it in GitHub Desktop.
Save mattfield11/ee7e44817751dcfc2ed119cb5a8b8534 to your computer and use it in GitHub Desktop.
ELASTICSEARCH AUTO COMPLETE SUGGESTER SAMPLE QUERY AND RESPONSE
POST wikipeople/_search?pretty
{
"_source": {
"excludes": [ "text" ]
},
"suggest": {
"people-suggest" : {
"prefix" : "ada",
"completion" : {
"field" : "suggest"
}
}
}
}
###########RESPONSE ####################
{
"took": 4,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 0,
"max_score": 0,
"hits": []
},
"suggest": {
"people-suggest": [
{
"text": "ada",
"offset": 0,
"length": 3,
"options": [
{
"text": "Ada Aharoni",
"_index": "wikipeople",
"_type": "wiki_page",
"_id": "AV4y2YV60gp1VjRVHXAK",
"_score": 1,
"_source": {
"fullurl": "https://en.wikipedia.org/wiki/Ada_Aharoni",
"suggest": [
{
"input": "Ada Aharoni",
"weight": 1
}
],
"categories": [
"[[en:Category:1933 births]]",
"[[en:Category:20th-century poets]]",
"[[en:Category:20th-century women writers]]",
"[[en:Category:Alumni of Birkbeck, University of London]]",
"[[en:Category:Articles with hCards]]",
"[[en:Category:Hebrew-language poets]]",
"[[en:Category:Israeli novelists]]",
"[[en:Category:Israeli poets]]",
"[[en:Category:Israeli women novelists]]",
"[[en:Category:Israeli women poets]]",
"[[en:Category:Jewish novelists]]",
"[[en:Category:Jewish poets]]",
"[[en:Category:Jewish refugees]]",
"[[en:Category:Living people]]",
"[[en:Category:Modern Hebrew writers]]",
"[[en:Category:Webarchive template wayback links]]"
],
"title": "Ada Aharoni"
}
},
{
"text": "Ada Albrecht",
"_index": "wikipeople",
"_type": "wiki_page",
"_id": "AV4y983Q0gp1VjRVHYE0",
"_score": 1,
"_source": {
"fullurl": "https://en.wikipedia.org/wiki/Ada_Albrecht",
"suggest": [
{....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment