Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save pcdinh/4353161 to your computer and use it in GitHub Desktop.

Select an option

Save pcdinh/4353161 to your computer and use it in GitHub Desktop.
curl -X DELETE localhost:9200/custom_analyzer_test
curl -X PUT localhost:9200/custom_analyzer_test -d '
{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 2,
"analysis" : {
"analyzer" : {
"url_analyzer" : {
"type" : "custom",
"tokenizer" : "uax_url_email",
"filter" : ["stop", "lowercase"]
}
}
}
}
},
"mappings": {
"url": {
"properties": {
"url": {
"type": "string",
"analyzer": "url_analyzer",
"boost": 10
},
"title": {
"type": "string",
"analyzer": "snowball",
"boost": 5
},
"description": {
"type": "string",
"analyzer": "snowball"
},
"tags": {
"type": "string",
"analyzer": "keyword"
}
}
}
}
}
'
curl -X POST http://localhost:9200/custom_analyzer_test/url -d '
{
"url" : "http://www.euruko2011.org",
"title" : "EURUKO 2011",
"description" : "The greatest Ruby conference in Europe!",
"tags" : ["ruby", "conference"]
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment