相关疑难解决方法(0)

为什么Elasticsearch"not_analyzed"字段被分成条款?

我的映射定义中有以下字段:

...
"my_field": {
  "type": "string",
  "index":"not_analyzed"
}
...
Run Code Online (Sandbox Code Playgroud)

当我索引用的有价票证my_field = 'test-some-another'该值被分成3个术语:test,some,another.

我究竟做错了什么?

我创建了以下索引:

curl -XPUT localhost:9200/my_index -d '{
   "index": {
    "settings": {
      "number_of_shards": 5,
      "number_of_replicas": 2
    },
    "mappings": {
      "my_type": {
        "_all": {
          "enabled": false
        },
        "_source": {
          "compressed": true
        },
        "properties": {
          "my_field": {
            "type": "string",
            "index": "not_analyzed"
          }
        }
      }
    }
  }
}'
Run Code Online (Sandbox Code Playgroud)

然后我索引以下文档:

curl -XPOST localhost:9200/my_index/my_type -d '{
  "my_field": "test-some-another"
}'
Run Code Online (Sandbox Code Playgroud)

然后我使用以下API 使用插件https://github.com/jprante/elasticsearch-index-termlist: curl -XGET localhost:9200/my_index/_termlist …

elasticsearch

21
推荐指数
1
解决办法
2万
查看次数

ElasticSearch - 返回查询的facet的完整值

我最近开始使用ElasticSearch.我尝试完成一些用例.其中一个我有问题.

我用一些用户的全名索引了一些用户(例如"Jean-Paul Gautier","Jean De La Fontaine").

我试图让所有的全名响应一些查询.

例如,我希望100个最常用的全名由"J"开始

{
  "query": {
    "query_string" : { "query": "full_name:J*" } }
  },
  "facets":{
    "name":{
      "terms":{
        "field": "full_name",
        "size":100
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

我得到的结果是全名:"Jean","Paul","Gautier","De","La","Fontaine".

如何获得"Jean-Paul Gautier"和"Jean De La Fontaine"(所有full_name值由'J'乞讨)?"post_filter"选项不是这样做的,它只限制上面这个子集.

  • 我必须配置这个full_name方面的"如何工作"
  • 我必须为当前查询添加一些选项
  • 我必须做一些"映射"(目前非常模糊)

谢谢

lucene elasticsearch

8
推荐指数
1
解决办法
3398
查看次数

标签 统计

elasticsearch ×2

lucene ×1