Skip to content

Instantly share code, notes, and snippets.

@jl982
Last active December 20, 2015 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jl982/6149763 to your computer and use it in GitHub Desktop.
Save jl982/6149763 to your computer and use it in GitHub Desktop.
# Remove old data
curl -XDELETE localhost:9200/test
# Insert single document into a non-existing index
curl -XPOST localhost:9200/test/post -d '{ "content" : "drawing" }'
# Add kstem token filter
curl -XPOST localhost:9200/test/_close
curl -XPUT http://localhost:9200/test/_settings -d '{
"settings":{
"analysis":{
"analyzer":{
"default":{
"type":"custom",
"tokenizer":"standard",
"filter":[ "standard", "kstem" ]
}
}
}
}
}'
curl -XPOST localhost:9200/test/_open
# "drawing" returns result, but "draw" doesn't
curl localhost:9200/test/_search?q=drawing
curl localhost:9200/test/_search?q=draw
# Change kstem to porter_stem token filter
curl -XPOST localhost:9200/test/_close
curl -XPUT http://localhost:9200/test/_settings -d '{
"settings":{
"analysis":{
"analyzer":{
"default":{
"type":"custom",
"tokenizer":"standard",
"filter":[ "standard", "porter_stem" ]
}
}
}
}
}'
curl -XPOST localhost:9200/test/_open
# Neither "drawing" nor "draw" returns result
curl localhost:9200/test/_search?q=drawing
curl localhost:9200/test/_search?q=draw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment