Skip to content

Instantly share code, notes, and snippets.

@yanglikun
Created July 3, 2017 08:13
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 yanglikun/a27cb441a43e27d19b74a950eda498d4 to your computer and use it in GitHub Desktop.
Save yanglikun/a27cb441a43e27d19b74a950eda498d4 to your computer and use it in GitHub Desktop.
es-share-解析
DELETE es_demo_analyzer_index
POST /es_demo_analyzer_index/
{
"settings": {
"index": {
"analysis": {
"analyzer":{
"myCustomAnalyzer":{
"type":"custom",
"tokenizer":"myCustomTokenizer",
"filter":["myCustomFilter1","myCustomFilter2"],
"char_filter":["myCustomCharFilter"]
}
},
"tokenizer":{
"myCustomTokenizer":{
"type":"letter"
}
},
"filter":{
"myCustomFilter1":{
"type":"lowercase"
},
"myCustomFilter2":{
"type":"kstem"
}
},
"char_filter":{
"myCustomCharFilter":{
"type":"mapping",
"mappings":["jingdong=>jd","360buy=>jd"]
}
}
}
}
},
"mappings":{
"es_demo_analyzer_type":{
"properties":{
"description":{
"type":"string",
"analyzer":"myCustomAnalyzer"
}
}
}
}
}
PUT /es_demo_analyzer_index/es_demo_analyzer_type/1
{"description":"go shopping go 360buy"}
PUT /es_demo_analyzer_index/es_demo_analyzer_type/2
{"description":"go shopping go jingdong"}
PUT /es_demo_analyzer_index/es_demo_analyzer_type/3
{"description":"go shopping go jd"}
PUT /es_demo_analyzer_index/es_demo_analyzer_type/4
{"description":"go shopping"}
GET /es_demo_analyzer_index/es_demo_analyzer_type/_search
{
"query": {
"match": {
"description": {
"query":"jd"
}
}
}
}
GET /es_demo_analyzer_index/_analyze
{
"text":"go shopping go 360buy"
}
GET /es_demo_analyzer_index/es_demo_analyzer_type/1/_termvectors
{
"fields" : ["description"],
"offsets" : true,
"payloads" : true,
"positions" : true,
"term_statistics" : true,
"field_statistics" : true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment