相关疑难解决方法(0)

elasticsearch - 单个字段的返回项频率

我一直在尝试使用facet来获得字段的术语频率.我的查询只返回一个匹配,所以我希望facet返回特定字段中频率最高的条件.

我的映射:

{
"mappings":{
    "document":{
        "properties":{
            "tags":{
                "type":"object",
                "properties":{
                    "title":{
                        "fields":{
                            "partial":{
                                "search_analyzer":"main",
                                "index_analyzer":"partial",
                                "type":"string",
                                "index" : "analyzed"
                            }
                            "title":{
                                "type":"string",
                                "analyzer":"main",
                                "index" : "analyzed"
                            }
                        },
                        "type":"multi_field"
                    }
                }
            }
        }
    }
},

"settings":{
    "analysis":{
        "filter":{
            "name_ngrams":{
                "side":"front",
                "max_gram":50,
                "min_gram":2,
                "type":"edgeNGram"
            }
        },

        "analyzer":{
            "main":{
                "filter": ["standard", "lowercase", "asciifolding"],
                "type": "custom",
                "tokenizer": "standard"
            },
            "partial":{
                "filter":["standard","lowercase","asciifolding","name_ngrams"],
                "type": "custom",
                "tokenizer": "standard"
            }
        }
    }
}

}
Run Code Online (Sandbox Code Playgroud)

测试数据:

 curl -XPUT localhost:9200/testindex/document -d '{"tags": {"title": "people also kill people"}}'
Run Code Online (Sandbox Code Playgroud)

查询:

 curl -XGET …
Run Code Online (Sandbox Code Playgroud)

elasticsearch

2
推荐指数
1
解决办法
5751
查看次数

标签 统计

elasticsearch ×1