ElasticSearch - 如何按类型搜索?
ElasticSearch - How to search by type?
我已将具有给定索引和类型的项目放入 ElasticSearch。我如何找回它?
详情:
GET /_search
{
"query": {
"type" : {
"value" : "_doc"
}
}
}
但我不明白。我该怎么办?
我试过 运行 它是这样的,但没有用:
curl XGET 'http://localhost:9200/disney/_search' -d '
{
"query": {
"type" : {
"value" : "disneytype"
}
}
}'
这会引发错误:
Invoke-WebRequest : A positional parameter cannot be found that accepts argument
'http://localhost:9200/disney/_search'.
At line:1 char:1
+ curl XGET 'http://localhost:9200/disney/_search' -d '
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
有什么想法可以 运行 正确吗?
您遇到的错误与 Elasticsearch 无关。这是 PowerShell 的一些问题。将 cURL
调用替换为 Invoke-WebRequest
:
Invoke-WebRequest -Method 'POST' -Uri 'http://localhost:9200/_search' -ContentType "application/json" -Body '
{
"query": {
"type": {
"value": "disneytype"
}
}
}'
我个人更喜欢使用 Kibana 来发现我的 ES 索引。方便多了
另一种方法是 运行 它像这样内联:
curl.exe -XGET --data-binary '{ "query": { "type" : { "value" : "disneytype" }, studioid: "AAAAA" } }' -H 'content-type: application/json;' http://localhost:9200/
我已将具有给定索引和类型的项目放入 ElasticSearch。我如何找回它?
详情:
GET /_search
{
"query": {
"type" : {
"value" : "_doc"
}
}
}
但我不明白。我该怎么办?
我试过 运行 它是这样的,但没有用:
curl XGET 'http://localhost:9200/disney/_search' -d '
{
"query": {
"type" : {
"value" : "disneytype"
}
}
}'
这会引发错误:
Invoke-WebRequest : A positional parameter cannot be found that accepts argument
'http://localhost:9200/disney/_search'.
At line:1 char:1
+ curl XGET 'http://localhost:9200/disney/_search' -d '
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
有什么想法可以 运行 正确吗?
您遇到的错误与 Elasticsearch 无关。这是 PowerShell 的一些问题。将 cURL
调用替换为 Invoke-WebRequest
:
Invoke-WebRequest -Method 'POST' -Uri 'http://localhost:9200/_search' -ContentType "application/json" -Body '
{
"query": {
"type": {
"value": "disneytype"
}
}
}'
我个人更喜欢使用 Kibana 来发现我的 ES 索引。方便多了
另一种方法是 运行 它像这样内联:
curl.exe -XGET --data-binary '{ "query": { "type" : { "value" : "disneytype" }, studioid: "AAAAA" } }' -H 'content-type: application/json;' http://localhost:9200/