我可以像这样快速进行URI搜索
GET twitter/tweet/_search?q=user:kimchy
Run Code Online (Sandbox Code Playgroud)
我可以这样搜索多个字段吗?例如,user:kimchy AND age:23?
我尝试了1(错误):
curl -XDELETE localhost:9200/myindex/
curl localhost:9200/myindex/mytype/1 -d '{"a":1,"b":9}'
curl localhost:9200/myindex/mytype/2 -d '{"a":9,"b":9}'
curl localhost:9200/myindex/mytype/3 -d '{"a":9,"b":1}'
Run Code Online (Sandbox Code Playgroud)
说我只想要文件{"a":9, "b":9},我试过
GET localhost:9200/myindex/_search?q=a:9&b:9
Run Code Online (Sandbox Code Playgroud)
但是我得到了错误
{
error: {
root_cause: [{
type: "illegal_argument_exception",
reason: "request [/myindex/_search] contains unrecognized parameter: [b:9]"
}],
type: "illegal_argument_exception",
reason: "request [/myindex/_search] contains unrecognized parameter: [b:9]"
},
status: 400
}
Run Code Online (Sandbox Code Playgroud)
我尝试了2(工作!):
GET localhost:9200/myindex/_search?q=a:9 AND b:9
Run Code Online (Sandbox Code Playgroud)
空间很重要。或者,使用%20。
小智 6
是的你可以。尝试这样的事情:
GET twitter/tweet/_search?q=user:kimchy%20AND%20age:23
Run Code Online (Sandbox Code Playgroud)
请注意,如果您对此进行URI解码,则等效于:
GET twitter/tweet/_search?q=user:kimchy AND age:23
Run Code Online (Sandbox Code Playgroud)
请注意,当您使用这种REST端点时,我认为您实际上是在利用query_string_query。请参阅这些文档,以了解查询字符串语言的范围以及您可以使用的功能。
| 归档时间: |
|
| 查看次数: |
1818 次 |
| 最近记录: |