Skip to content

ik分词器

常规的最常用的使用方式就是, 数据插入存储时用 ik_max_word模式分词, 检索时,用ik_smart模式分词,即:索引时最大化的将文章内容分词,搜索时更精确的搜索到想要的结果

docker

https://www.docker.elastic.co/

elasticsearch


curl -X <VERB> '<PROTOCOL>://<HOST>:<PORT>/<PATH>?<QUERY_STRING>' -d '<BODY>'

curl -X PUT "localhost:9200/{index}"


curl -X POST "localhost:9200/{index}/_doc/" -H 'Content-Type: application/json' -d'
{
  "@timestamp": "2021-04-01T00:00:00",
  "message": "Elasticsearch is fun to learn!"
}'



curl -X GET "localhost:9200/{index}/_search" -H 'Content-Type: application/json' -d'
{
  "query": {
    "match": {
      "message": "fun"
    }
  }
}'


curl -X POST "localhost:9200/{index}/_update/{id}" -H 'Content-Type: application/json' -d'
{
  "doc": {
    "message": "Elasticsearch is super fun to learn!"
  }
}'

_search  query( term、prefix、wildcard、fuzzy,boost) aggs
_msearch
_doc 创建文档时
_mapping
_bulk
_delete_by_query
_update
_refresh
_sql


Query DSL(Domain Specific Language)  特定领域的语言

倒排索引的底层实现是基于:FST(Finite State Transducer)数据结构。
lucene 从 4+版本后开始大量使用的数据结构是 FST。FST 有两个优点:
1、空间占用小。通过对词典中单词前缀和后缀的重复利用,压缩了存储空间;
2、查询速度快。O(len(str))的查询时间复杂度。 

搜索过程 query then fetch

更新于:

note