首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Elasticsearch - Tokenizer配置

Elasticsearch - Tokenizer配置
EN

Stack Overflow用户
提问于 2015-07-02 00:47:32
回答 1查看 55关注 0票数 0

有人知道要使用什么标记器以及如何启用以下规则,

输入:"test1-data.example.com","test2-new.example.com","new1-test.example.com“

输出(预期):

代码语言:javascript
复制
test1-data.example.com test2-new.example.com new1-test.exampl.com
EN

回答 1

Stack Overflow用户

发布于 2015-07-02 00:56:25

它是否能解决你的问题还不是很明显,但这里有一种方法可以让你听起来像是在问:

代码语言:javascript
复制
DELETE /test_index

PUT /test_index
{
   "settings": {
      "number_of_shards": 1
   },
   "mappings": {
      "doc": {
         "_all": {
            "enabled": true,
            "store": true,
            "index": "not_analyzed"
         },
         "properties": {
            "text_field": {
               "type": "string",
               "include_in_all": true
            }
         }
      }
   }
}

PUT /test_index/doc/1
{
    "text_field": ["test1-data.example.com", "test2-new.example.com", "new1-test.example.com"]
}

POST /test_index/_search
{
    "fields": [
       "_all"
    ]
}
...
{
   "took": 3,
   "timed_out": false,
   "_shards": {
      "total": 5,
      "successful": 5,
      "failed": 0
   },
   "hits": {
      "total": 1,
      "max_score": 1,
      "hits": [
         {
            "_index": "test_index",
            "_type": "doc",
            "_id": "1",
            "_score": 1,
            "fields": {
               "_all": "test1-data.example.com test2-new.example.com new1-test.example.com "
            }
         }
      ]
   }
}

以下是Sense中的代码:

http://sense.qbox.io/gist/45200711a41268634439b669e18541e68042ac8a

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31167234

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档