如何进行elasticsearch 前缀匹配的代码分析(elasticsearch,开发技术)

时间:2024-05-02 21:58:00 作者 : 石家庄SEO 分类 : 开发技术
  • TAG :

    %E5%A6%82%E4%BD%95%E8%BF%9B%E8%A1%8Celasticsearch+%E5%89%8D%E7%BC%80%E5%8C%B9%E9%85%8D%E7%9A%84%E4%BB%A3%E7%A0%81%E5%88%86%E6%9E%90

curl -XDELETE 'http://localhost:9200/ess/';

curl -XPOST 'http://localhost:9200/ess' -d '{

"analysis": {

"filter": {

"autocomplete_filter": {

"type": "edge_ngram",

"min_gram": 1,

"max_gram": 20,

"token_chars": ["whitespace"]

}

},

"analyzer": {

"autocomplete": {

"type": "custom",

"tokenizer": "whitespace",

"filter": [

"lowercase",

"autocomplete_filter"

]

},

"postsearch": {

"tokenizer": "keyword",

"filter": [

"lowercase"

]

}

}

}

}'

curl -XPOST 'http://localhost:9200/ess/ess/_mapping' -d'

{

"ess": {

"properties": {

"id": {

"type" : "long"

},

"fullname": {

"type" : "string"

},

"allname": {

"type" : "string",

"analyzer": "autocomplete",

"search_analyzer": "postsearch"

}

}

}

}'

curl 'localhost:9200/ess/_analyze?pretty=1&analyzer=autocomplete' -d 'zs zhangsan zsan zhangs 张三 张s zns'

curl 'localhost:9200/ess/_analyze?pretty=1&analyzer=postsearch' -d 'Z'

curl -XPOST http://localhost:9200/ess/ess/1 -d'

{"fullname":"张三" , "allname" : "zs zhangsan zsan zhangs 张三 张s zns" }

'

curl -XPOST http://localhost:9200/ess/ess/2 -d'

{"fullname":"张三风" , "allname" : "zsf zhangsanfeng zsanfeng zhangsf 张三 三风 张sf znsf" }

'

curl -XPOST http://localhost:9200/ess/ess/3 -d'

{"fullname":"李三风" , "allname" : "lsf lisanfeng lsanfeng lsf 李三 三风 李s lsf" }

'

curl -XGET 'http://localhost:9200/ess/_search?pretty' -d '{

"query": {

"match": {

"allname": "张S"

}

}

}'

本文:如何进行elasticsearch 前缀匹配的代码分析的详细内容,希望对您有所帮助,信息来源于网络。
上一篇:J2EE如何运行web客户端下一篇:

10 人围观 / 0 条评论 ↓快速评论↓

(必须)

(必须,保密)

阿狸1 阿狸2 阿狸3 阿狸4 阿狸5 阿狸6 阿狸7 阿狸8 阿狸9 阿狸10 阿狸11 阿狸12 阿狸13 阿狸14 阿狸15 阿狸16 阿狸17 阿狸18