elasticsearch,lucene,Java,elasticsearch,Lucene" /> elasticsearch,lucene,Java,elasticsearch,Lucene" />

Java Elasticsearch小写标记符怪癖?

Java Elasticsearch小写标记符怪癖?,java,elasticsearch,lucene,Java,elasticsearch,Lucene,我正在elasticsearch中测试url-s的映射 我希望能够通过域名和tld搜索条目,例如example.com 没有tld,例如,返回完整域文档 喜欢http://example.com 以及www.example.com和类似网站 我把这个映射放到了ES上——从某种意义上说: PUT /en_docs { "mappings": { "url": { "properties": { "content": {

我正在elasticsearch中测试url-s的映射

我希望能够通过域名和tld搜索条目,例如example.com 没有tld,例如,返回完整域文档 喜欢http://example.com 以及www.example.com和类似网站

我把这个映射放到了ES上——从某种意义上说:

PUT /en_docs
    { 
   "mappings": {
      "url": {
        "properties": {
          "content": {
            "type": "string",
            "analyzer" : "urlzer"
          }
        }
      }
    },

    "settings": {
        "analysis": {
            "analyzer": {
                "urlzer": {
                  "type": "custom",
                  "tokenizer": "lowercase",
                  "filter": [ "stopwords_filter" ]
                }

            },
            "filter" : {
              "stopwords_filter" : {
                "type" : "stop",
                "stopwords" : ["http", "https", "ftp", "www"]
              }
            }
        }
    }
}
现在,当我索引url文档时,例如

POST /en_docs/url
{
"content":  "http://example.com"
}
我可以通过搜索example.com获得它,但example不会返回任何内容。 正如文档所说,我在我的分析器中使用的小写标记器以及我的分析器的直接测试所显示的那样,给出了示例和com标记,但是当我搜索索引文档时,示例没有返回任何内容:

GET /en_docs/url/_search?q=example
不获取结果,但如果查询为example.com,则返回结果


我遗漏了什么?

查询看起来如何?这对我有用。下面是示例要点:@tonioj,您使用什么查询进行搜索?我使用搜索查询编辑了我的问题&其他请求的端点。