栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

Elastic search 带空格的术语

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Elastic search 带空格的术语

参数上使用的query_string查询首先通过在空格上分割查询字符串来解析查询字符串。您需要用
其他保留空间的东西替换它。在这里match查询将是一个不错的选择。我还将使用其他分析器进行搜索-您无需在其中应用
ngram:

curl -XPUT http://localhost:9200/autocomplete/ -d '{      "index": {        "analysis": {"analyzer": {     "placeNameIndexAnalyzer" : {         "type": "custom",         "tokenizer": "keyword",         "filter" : ["trim", "lowercase", "asciifolding", "left_ngram"]     },     "placeNameSearchAnalyzer" : {         "type": "custom",         "tokenizer": "keyword",         "filter" : ["trim", "lowercase", "asciifolding"]     } }, "filter": {     "left_ngram": {         "type" : "edgeNGram",         "side" : "front",         "min_gram" : 3,         "max_gram" : 12     } }        }    }}'curl -XPUT http://localhost:9200/autocomplete/geo/_mapping/ -d '{    "geo": {        "properties": { "application_id": {         "type": "string" }, "alias": {         "type": "string",         "index_analyzer": "placeNameIndexAnalyzer",         "search_analyzer": "placeNameSearchAnalyzer" }, "name": {          "type": "string" }, "object_type": {          "type": "string" }        }    }}'curl -XPOST "http://localhost:9200/autocomplete/geo?refresh=true" -d '{        "application_id":"982",    "name":"Buenos Aires",    "alias":["bue", "buenos aires", "bsas", "bs as", "baires"],    "object_type":"cities"}'curl -XGET 'localhost:9200/autocomplete/geo/_search' -d '{    "query": {        "match": { "alias": "bs as"        }    }}'


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/406274.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号