0

是否可以在构面中使用本机脚本?

例如,当我运行时:

{
  "facets": {
    "judges": {
      "terms": {
        "field": "judges.untouched",
        "size": 10,
        "all_terms": false,
        "global_facets": true,
        "_script": {
          "script": "facet_matcher",
          "params": {
            "a": "b"
          },
          "lang": "native"
        }
      }
    }
}

它正确使用 elasticsearch.yml 中提供的本机方面

但是当我获取更多方面时,elasticsearch 无法解析查询:

{
  "facets": {
    "judges": {
      "terms": {
        "field": "judges.untouched",
        "size": 10,
        "all_terms": false,
        "global_facets": true,
        "_script": {
          "script": "facet_matcher",
          "params": {
            "a": "b"
          },
          "lang": "native"
        }
      }
    },
    "judges_selected": {
      "terms": {
        "field": "judges.untouched",
        "size": 10,
        "all_terms": false
      },
      "global_facets": false
    }
  }
}

有错误:

... Parse Failure [No parser for element [judges_selected]]]; }]

我究竟做错了什么?是否可以使用这样的构面脚本?

谢谢

4

1 回答 1

1

看起来 Elasticsearch 只是被这个_script元素弄糊涂了。尝试这个:

{
  "facets": {
    "judges": {
      "terms": {
        "field": "judges.untouched",
        "size": 10,
        "all_terms": false,
        "global_facets": true,
        "script": "facet_matcher",
        "params": {
          "a": "b"
        },
        "lang": "native"
    }
  }
}
于 2013-07-08T16:26:38.330 回答