Skip to content

Instantly share code, notes, and snippets.

@clintongormley
Created August 17, 2012 09:24
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save clintongormley/992e0e704e035e8a1770 to your computer and use it in GitHub Desktop.
Save clintongormley/992e0e704e035e8a1770 to your computer and use it in GitHub Desktop.
curl -XPUT 'http://127.0.0.1:9200/test/?pretty=1' -d '
{
"mappings" : {
"interests" : {
"properties" : {
"name" : {
"fields" : {
"ngrams" : {
"type" : "string",
"analyzer" : "my_ngram"
},
"name" : {
"type" : "string",
"analyzer" : "english"
}
},
"type" : "multi_field"
}
}
}
},
"settings" : {
"analysis" : {
"filter" : {
"mynGram" : {
"max_gram" : 10,
"min_gram" : 2,
"type" : "edge_ngram"
}
},
"analyzer" : {
"my_ngram" : {
"filter" : [
"stop",
"lowercase",
"mynGram"
],
"tokenizer" : "standard"
}
}
}
}
}
'
curl -XPOST 'http://127.0.0.1:9200/test/interests?pretty=1' -d '{ "name" : "meet entrepreneurs" }'
curl -XPOST 'http://127.0.0.1:9200/test/interests?pretty=1' -d '{ "name" : "play basketball"}'
curl -XPOST 'http://127.0.0.1:9200/test/interests?pretty=1' -d '{ "name" : "trekking"}'
curl -XPOST 'http://127.0.0.1:9200/test/_refresh?pretty=1'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment