在ElasticSearch中搜索和排序动态字段

时间:2018-05-28 14:11:30

标签: sorting elasticsearch search aggregate dynamic-mapping

创建了一个颜色对象,其中包含颜色的十六进制代码及其百分比

/ colors / mapping 返回

{   
  "colors": {
    "mappings": {
      "colors_array": {
        "dynamic": "strict",
        "properties": {
          "colors": {
            "dynamic": "true",
            "properties": {
              "#2f4f4f": {
                "type": "long"
              },
              "#808080": {
                "type": "long"
              },
              "#bc8f8f": {
                "type": "long"
              },
              "#dc143c": {
                "type": "long"
              },
              "#e6e6fa": {
                "type": "long"
              }
            }
          }
        }
      }
    }
  }
}

注意:颜色十六进制代码被创建为动态映射对象

我应该如何制定查询,以便传递特定的颜色,并根据聚合的匹配百分比对结果进行排序,即根据此数字对匹配的颜色百分比求和并对结果进行排序?

0 个答案:

没有答案