Skip to content

Instantly share code, notes, and snippets.

@michaelwallett
Created January 22, 2015 19:28
Show Gist options
  • Save michaelwallett/f03815fb2d563d6bbbeb to your computer and use it in GitHub Desktop.
Save michaelwallett/f03815fb2d563d6bbbeb to your computer and use it in GitHub Desktop.
DELETE /restaurants
PUT /restaurants
{
"mappings": {
"restaurant": {
"properties": {
"suggest": {
"type": "completion",
"payloads" : true,
"context": {
"rid": {
"type": "category",
"default": "*"
}
}
}
}
}
}
}
PUT /restaurants/restaurant/1001
{
"suggest": {
"input": ["Mango Tree", "London", "Victoria"],
"output": "Mango Tree",
"payload": {
"rid": 1001
},
"context": {
"rid": ["*", "1001"]
}
}
}
PUT /restaurants/restaurant/1002
{
"suggest": {
"input": ["Skylon Grill", "London", "Waterloo"],
"output": "Skylon Grill",
"payload": {
"rid": 1002
},
"context": {
"rid": ["*", "1002"]
}
}
}
POST /restaurants/_suggest
{
"suggest": {
"text": "London",
"completion": {
"field": "suggest",
"context": {
"rid": "1002"
}
}
}
}
POST /restaurants/_suggest
{
"suggest": {
"text": "Mongo",
"completion": {
"field": "suggest",
"fuzzy": {
"edit_distance": 2
},
"context": {
"rid": "*"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment