gpt4 book ai didi

elasticsearch - 弹性堆栈Twitter示例推文

转载 作者:行者123 更新时间:2023-12-03 00:03:09 24 4
gpt4 key购买 nike

我是 flex 堆栈新手,不确定如何解决该问题。我已经设法使用Twitter输入插件来获取带有特定关键字的实时tweets实时流,但是我想获取没有特定关键字的实时实时t样本,仅占所有实时tweet的百分比。我尝试搜索操作方法,但是找不到很好的文档,我相信我需要使用GET statuss / sample API,但是上面没有文档。这是我现在拥有的:

input {
twitter {
consumer_key => " cosumer_key"
consumer_secret => "consumer_secret"
oauth_token => "token"
oauth_token_secret => "secret"
keywords => ["something"]
languages => ["en"]
full_tweet => true
}
}
output {
elasticsearch {}
}

我如何不使用关键字来搜索所有样本推文?

提前非常感谢您。

最佳答案

这是一个随机分数查询示例,它可以解决您的问题:

GET /twitter/_search
{
"query": {
"function_score": {
"query": {
"match_all": {}
},
"functions": [
{
"random_score": {}
}
]
}
}
}

编辑-添加一个logstash配置,该配置也需要随机输入:
input {
twitter {
consumer_key => " cosumer_key"
consumer_secret => "consumer_secret"
oauth_token => "token"
oauth_token_secret => "secret"
keywords => ["something"]
languages => ["en"]
full_tweet => true,
use_samples => true
}
}
output {
elasticsearch {}
}

use_samples:

Returns a small random sample of all public statuses. The tweets returned by the default access level are the same, so if two different clients connect to this endpoint, they will see the same tweets. If set to true, the keywords, follows, locations, and languages options will be ignored. Default ⇒ false

关于elasticsearch - 弹性堆栈Twitter示例推文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47082822/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com