yve*_*man 80
curl -XGET 'http://localhost:9200/_cat/indices?v'
Run Code Online (Sandbox Code Playgroud)
会给你所有的索引.
curl -XGET 'http://localhost:9200/_mapping?pretty=true'
Run Code Online (Sandbox Code Playgroud)
将为您提供这些索引中的文档类型及其映射.
And*_*ite 30
yvespeirsman的答案是正确的,但如果你想看到索引的类型,你可以使用jq来获得更紧凑的答案.
curl -s -XGET 'http://localhost:9200/_mapping' | jq 'to_entries | .[] | {(.key): .value.mappings | keys}'
Run Code Online (Sandbox Code Playgroud)
hub*_*rdr 17
某些映射太大而无法有效地使用_mapping解析类型.而是考虑聚合.可能要快得多.对于索引:
curl -XGET "http://localhost:9200/_search" -d'
{
"aggs": {
"indicesAgg": {
"terms": {
"field": "_index",
"size": 200
}
}
},
"size": 0
}'
Run Code Online (Sandbox Code Playgroud)
对于特定索引的类型(或者在所有索引中获取所有类型,只需在URL中排除索引名称{myIndex}):
curl -XGET "http://localhost:9200/myIndex/_search" -d'
{
"aggs": {
"typesAgg": {
"terms": {
"field": "_type",
"size": 200
}
}
},
"size": 0
}'
Run Code Online (Sandbox Code Playgroud)
我相信你也可以写一个单独的agg来返回它们.
| 归档时间: |
|
| 查看次数: |
52132 次 |
| 最近记录: |