Skip to content

Instantly share code, notes, and snippets.

@imotov
Created July 8, 2012 16:18
Show Gist options
  • Save imotov/3071582 to your computer and use it in GitHub Desktop.
Save imotov/3071582 to your computer and use it in GitHub Desktop.
curl -XDELETE 'http://localhost:9200/windowz'
echo
curl -XPUT 'http://localhost:9200/windowz' -d '{
"mappings" : {
"message" : {
"properties" : {
"title" : {
"type" : "string",
"search_analyzer" : "str_search_analyzer",
"index_analyzer" : "str_index_analyzer"
}
}
}
},
"settings" : {
"analysis" : {
"analyzer" : {
"str_search_analyzer" : {
"tokenizer" : "standard",
"filter" : ["lowercase","custom_stop"]
},
"str_index_analyzer" : {
"tokenizer" : "standard",
"filter" : ["lowercase", "custom_stop"]
}
},
"filter" : {
"custom_stop": {
"type": "stop",
"stopwords": ["a", "an", "and", "are", "as", "at", "be", "but", "by", "into", "is", "it", "of", "on", "or", "such", "that", "the", "their", "there", "these", "they", "this", "to", "was", "will","we"]
}
}
}
}
}'
echo
curl -XGET 'http://localhost:9200/windowz/_analyze?analyzer=str_index_analyzer&pretty=true' -d 'Alice looked all round the table, but there was nothing on it but tea.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment