听课笔记(61讲—62讲)

手动如何创建索引,如何修改索引

听课笔记(61讲—62讲)

听课笔记(61讲—62讲)

听课笔记(61讲—62讲)

听课笔记(61讲—62讲)

第62讲

听课笔记(61讲—62讲)

听课笔记(61讲—62讲)

 听课笔记(61讲—62讲)

听课笔记(61讲—62讲)

听课笔记(61讲—62讲)

 

自定义分词器:

PUT /my_index
{
  "settings": {
    "analysis": {
      "analyzer": {
        "es_std":{
          "type":"standard",
          "stopwoords":"_english"
        }
      }
    }
  }
}

GET /my_index/_analyze
{
  "analyzer": "es_std",
  "text": "a dog is in the house"
}

PUT /my_index
{
  "settings": {
    "analysis": {
      "char_filter": {
        "&_to_and":{
          "type":"mapping",
          "mapping":["&=>and"]
        }
      },
      "filter": {
        "my_stopwords":{
          "type":"stop",
          "stopwords":["the","a"]
        }
      },
      "analyzer": {
        "my_analyzer":{
          "type":"custom",
          "char_filter":["html_strip","&_to_and"],
          "tokenizer":"standard",
          "filter":["lowercase","my_stopwords"]
        }
      }
    }
  }
}

GET /my_index/_analyze
{
  "text": "the quick & brown fox",
  "analyzer": "my_analyzer"
}
GET /my_index/_analyze
{
  "text": "tom&jerry are a friend in the house,<a>,haha!!",
  "analyzer": "my_analyzer"
}
PUT /my_index/_analyze
{
  "properties":{
    "title":{
      "type":"string",
      "analyzer":"my_analyzer"
    }
  }
}

 

相关文章: