3

很确定我犯了一些巨大的错误,但我不知道如何对其进行排序。

我的 couchdb 河和我的索引定义如下:

curl -XPUT 'localhost:9200/_river/my_index/_meta' -d '{
"type" : "couchdb",
"couchdb" : {
    "host" : "localhost",
    "port" : 5984,
    "db" : "my_db",
    "filter" : null
},
"index" : {
    "index" : "my_index",
    "type" : "my_index_type",
    "bulk_size" : "100",
    "bulk_timeout" : "10ms",
    "analysis": {
        "analyzer": {
            "tags_analyzer": {
                "type" : "custom",
                "tokenizer": "lowercase",
                "filter": ["lowercase", "asciifolding"]
            }
        }
    }
},
"mappings": {
    "tags": {
        "properties": {
            "tags": {
                "type": "string",
                "analyzer": "tags_analyzer",
                "boost": 10
            }
        }
    }
}}'

查询是通过 JAVA 应用程序执行的:

 QueryStringQueryBuilder queryBuilder = QueryBuilders.queryString(req.getParameter("tags"));
        queryBuilder.defaultField("tags");
        queryBuilder.analyzer("tags_analyzer");
        queryBuilder.analyzeWildcard(true);
        queryBuilder.lowercaseExpandedTerms(true);
        queryBuilder.defaultOperator(QueryStringQueryBuilder.Operator.AND);

        SearchResponse response = client.prepareSearch("idxscopus").setSearchType(SearchType.QUERY_THEN_FETCH).setQuery(queryBuilder)
                .addHighlightedField("tags", 0, 0)
                .setFrom(0).setExplain(true).execute().actionGet();

在查询阶段,我面临一个 QueryParsingException,告诉我我的自定义分析器丢失了:

omqueryery_stringb*default_fieldCtagsdefault_operatorBandanalyzerLtags_analyzerlowercase_expanded_terms#analyze_wildcard#xplain#highlighteldsgsagment_sizenumber_of_fragments;]]]; nested: QueryParsingException[[idxscopus] [query_string] analyzer [tags_analyzer] not found]; }{[BtMQ0EBJQVmFKyJTJMVhSA][idxscopus][1]: RemoteTransportException[[Aardwolf][inet[/10.1.1.2:9300]][search/phase/query]]; nested: SearchParseException[[idxscopus][1]: from[0],size[-1]: Parse Failure [Failed to parse source [:)

我做错了什么?我真的需要索引和搜索阶段的 asciifolding 功能。

谢谢!

4

0 回答 0