1

与当前的 ES 文档http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-mlt-field-query.html相反,在我的 ES 安装中,对于 more_like_this_field 查询,stop_words 是不受支持的字段.

version: 0.90.5
build_hash: c8714e8e0620b62638f660f6144831792b9dedee
build_timestamp: 2013-09-17T12:50:20Z
build_snapshot: false
lucene_version: 4.4

谁能证实这一点?

这就是我发送到服务器的内容

{
    "query": {
        "bool": {
            "must": [
                {
                    "match_all": {
                        "boost": 1
                    }
                },
                {
                    "more_like_this_field": {
                        "FieldA": {
                            "like_text": "House",
                            "boost": 1,
                            "min_doc_freq": 0,
                            "min_word_len": 0,
                            "min_term_freq": 0
                        }
                    }
                }
            ],
            "should": [
                {
                    "more_like_this_field": {
                        "Equipped": {
                            "like_text": "pool garage",
                            "boost": 0,
                            "min_doc_freq": 0,
                            "min_word_len": 0,
                            "min_term_freq": 0,
                            "stop_words": "garden"
                        }

                    }
                },
                {
                    "more_like_this_field": {
                        "Neighbourhood": {
                            "like_text": "school",
                            "boost": 5,
                            "min_doc_freq": 0,
                            "min_word_len": 0,
                            "min_term_freq": 0
                        }
                    }
                }
            ],
            "minimum_number_should_match": 2
        }
    }
}

这就是我得到的

QueryParsingException[[data] [mlt_field] query does not support [stop_words]];
4

1 回答 1

2

查询more_like_this也是如此,原因是它stop_words必须是一个数组。

{
    "more_like_this_field": {
        "Equipped": {
            "like_text": "pool garage",
            "boost": 0,
            "min_doc_freq": 0,
            "min_word_len": 0,
            "min_term_freq": 0,
            "stop_words": ["garden"]
        }
    }
}
于 2013-10-21T08:29:54.193 回答