Types 将percolator调用限制为ElasticSearch中的类型
正如文档中所解释的,当我使用_percolator存储查询时,例如:Types 将percolator调用限制为ElasticSearch中的类型,types,elasticsearch,restrict,Types,elasticsearch,Restrict,正如文档中所解释的,当我使用_percolator存储查询时,例如: curl -XPUT localhost:9200/_percolator/test/kuku -d '{ "color" : "blue", "query" : { "term" : { "field1" : "value1" } } }' 当我在“test”索引上过滤文档时,将运行此查询,但如果我想将其限制为“test”索引的“foo”类型,唯一的解决方案是在查询中添
curl -XPUT localhost:9200/_percolator/test/kuku -d '{
"color" : "blue",
"query" : {
"term" : {
"field1" : "value1"
}
}
}'
当我在“test”索引上过滤文档时,将运行此查询,但如果我想将其限制为“test”索引的“foo”类型,唯一的解决方案是在查询中添加一个类型:
curl -XPUT localhost:9200/_percolator/test/kuku -d '{
"type":"foo",
"color" : "blue",
"query" : {
"term" : {
"field1" : "value1"
}
}
}'
以及在添加文档时使用
curl -XGET localhost:9200/test/type1/_percolate -d '{
"doc" : {
"field1" : "value1"
},
"query" : {
"term" : {
"type" : "foo"
}
}
}'
还有别的解决办法吗?
我试过了
curl -XPUT localhost:9200/_percolator/test/foo/kuku
但它不起作用。另一种方法是将原始查询包装到过滤查询中,并为以下类型添加术语过滤器:
{
"query": {
"filtered":{
"query": {
"term":{
field1" : "value1"
}
},
"filter": {
"term": {
"_type" : "type1"
}
}
}
}
}