Eri*_*dry 2 elasticsearch elasticsearch-percolate
我想将我的许多文档扔给很多过滤器查询(我的查询计数是 6 位数字)。我已经找到了如何一次对多个文档进行多重渗透,但还没有找到如何一次批量添加多个查询。
根据文档,我可以使用以下方法在过滤器中注册查询:
curl -XPUT 'localhost:9200/my-index/.percolator/1' -d '{
"query" : {
"match" : {
"message" : "bonsai tree"
}
}
}'
Run Code Online (Sandbox Code Playgroud)
我可以一举添加其中的许多吗?
由于查询像普通文档一样被索引,你可以像这样简单地批量添加它们:
curl -s -XPOST localhost:9200/_bulk -d '
{ "index" : { "_index" : "my-index", "_type" : ".percolator", "_id" : "1" } }
{ "query" : { "match" : { "message" : "bonsai tree" } }}
{ "index" : { "_index" : "my-index", "_type" : ".percolator", "_id" : "2" } }
{ "query" : { "match" : { "message" : "abc" } }}
{ "index" : { "_index" : "my-index", "_type" : ".percolator", "_id" : "3" } }
{ "query" : { "match" : { "message" : "def" } }}
{ "index" : { "_index" : "my-index", "_type" : ".percolator", "_id" : "4" } }
{ "query" : { "match" : { "message" : "xyz" } }}
'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
501 次 |
| 最近记录: |