请检查以下链接:
# Analyze text: "the quick bröwn "jumped""
curl -XPUT 'http://127.0.0.1:9200/foo/' -d '
{
"index" : {
"analysis" : {
"analyzer" : {
"test_1" : {
"char_filter" : [
"html_strip"
],
"tokenizer" : "standard"
},
"test_2" : {
"filter" : [
"standard",
"lowercase",
"stop",
"asciifolding"
],
"char_filter" : [
"html_strip"
],
"tokenizer" : "standard"
}
}
}
}
}
'
curl -XGET 'http://127.0.0.1:9200/foo/_analyze?format=text&text=the+%3Cb%3Equick%3C%2Fb%3E+br%C3%B6wn+%3Cimg+src%3D%22fox%22%2F%3E+%26quot%3Bjumped%26quot%3B&analyzer=standard'
# "tokens" : "[b:5->6:]
#
# 3:
# [quick:7->12:]
#
# 4:
# [b:14->15:]
#
# 5:
# [bröwn:17->22:]
#
# 6:
# [img:24->27:]
#
# 7:
# [src:28->31:]
#
# 8:
# [fox:33->36:]
#
# 9:
# [quot:41->45:]
#
# 10:
# [jumped":46->57:]
# "
# }
curl -XGET 'http://127.0.0.1:9200/foo/_analyze?format=text&text=the+%3Cb%3Equick%3C%2Fb%3E+br%C3%B6wn+%3Cimg+src%3D%22fox%22%2F%3E+%26quot%3Bjumped%26quot%3B&analyzer=test_1'
# {
# "tokens" : "[the:0->3:]
#
# 2:
# [quick:7->12:]
#
# 3:
# [bröwn:17->22:]
#
# 4:
# [jumped:46->52:]
# "
# }
curl -XGET 'http://127.0.0.1:9200/foo/_analyze?format=text&text=the+%3Cb%3Equick%3C%2Fb%3E+br%C3%B6wn+%3Cimg+src%3D%22fox%22%2F%3E+%26quot%3Bjumped%26quot%3B&analyzer=test_2'
# {
# "tokens" : "[quick:7->12:]
#
# 3:
# [brown:17->22:]
#
# 4:
# [jumped:46->52:]
# "
# }
感谢clintongormley