According to my requirement, I custom the analyzer.I know how to check the result using this analyzer, it look like this:
curl -XGET "192.168.0.1:9200/test/_analyze?pretty=1&analyzer=pattern_analyzer" -d '2016/08/05 09:57:23 login.go:442: Info: needAAS = true'
And below is my setting:
curl -XPUT "192.168.0.1:9200/wangxiang_test_5?pretty=1" -d '
{
"settings": {
"analysis": {
"analyzer": {
"pattern_analyzer": {
"type": "custom",
"tokenizer": "pattern_tokenizer"
}
},
"tokenizer": {
"pattern_tokenizer": {
"type": "pattern",
"pattern": "(\d+:\d+:\d+)|(\d+/\d+/\d+)|\w+",
"group": "0"
}
}
},
"mappings": {
"logs": {
"properties": {
"message": {
"type": "string",
"analyzer": "pattern_analyzer"
}
}
}
}
}
}'
And below is how I insert data:
curl -XPOST "192.168.0.1:9200/test/logs" -d '{"message":"2016/08/05 09:57:23 login.go:442: Info: needAAS = true"}'
but it seems that my custom analyzer dosen't work when I insert a document to this index. I want to check the token result when insert one document to this index. Is there any API can do this?Or is there any wrong with my setting?