我认为这是一个简单的应用程序,但是我在互联网上找不到食谱。
您是否可以建议通过JSON
将python
查询发送到Elasticsearch实例,该实例将返回特定字段中特定术语的出现频率?
我猜想应该通过对术语 vector API进行一些调整来实现,但这似乎并不简单。
我不介意同时获得绝对频率和包含该术语的文档数量。
最佳答案
如果您有ID,则可以使用Multivectors API https://www.elastic.co/guide/en/elasticsearch/reference/6.8/docs-multi-termvectors.html
curl -X POST "localhost:9200/index/type/_mtermvectors?pretty" -H 'Content-Type: application/json' -d'
{
"ids" : ["your_document_id1","your_document_id2"],
"parameters": {
"fields": [
"your_field"
],
"term_statistics": true
}
}
'
您甚至可以传递带有您要分析的术语的人工文档。如此处所述(https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html),请确保将term_statistics设置为true,以便可以在整个索引中获取此信息:
关于elasticsearch - Elasticsearch:JSON获取特定术语的频率,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60166862/