【问题标题】:Range string as integer范围字符串为整数
【发布时间】:2017-03-07 11:07:45
【问题描述】:

假设我们有 Post 索引,该索引具有嵌套的 parameters 字段,具有严格映射并具有以下结构

    "parameters": {
        "type": "nested",
        "dynamic": "strict",
        "properties": {
          "kind": {
            "type": "text",
            "include_in_all": false
          },
          "label": {
            "type": "text",
            "include_in_all": false
          },
          "name": {
            "type": "text",
            "include_in_all": false
          },
          "option_id": {
            "type": "text",
            "include_in_all": false
          },
          "value": {
            "type": "text",
            "include_in_all": true
          }
        }
      },

Value 属性可以处理整数、浮点数和字符串值。但是,现在我必须按 parameters.value 过滤帖子,尤其是使用 range query(parameters.value > $needing_value)。我尝试使用range query。根据documentation parameters.value 将按字典顺序过滤。但我需要搜索整数。那么我该怎么做才能达到我的针头。

【问题讨论】:

    标签: php string elasticsearch integer


    【解决方案1】:

    我认为唯一自然的方法是在不同的属性中索引不同的类型。你可以使用https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-fields.html

    【讨论】:

      猜你喜欢
      • 2015-05-15
      • 2014-05-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-08
      相关资源
      最近更新 更多