我配置了一个自定义分析器并将一些文档放入索引中.现在我想调试我的设置,这样我就可以看到哪些n-gram实际上已经进入了索引.
当我之前使用过Solr时,有可能看到索引中保存了哪些字符串作为键以及它们的频率.
Ash*_*Ash 18
您可以使用下面的CURL查看任何现有索引。在运行之前,请用您的真实名称替换索引名称,它将按原样运行。
查看索引内容
curl -H 'Content-Type: application/json' -X GET https://localhost:9200/index_name?pretty
Run Code Online (Sandbox Code Playgroud)
并且输出将包括一个索引(请参阅输出中的设置)及其映射,它看起来像下面的输出-
{
"index_name": {
"aliases": {},
"mappings": {
"collection_name": {
"properties": {
"test_field": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
},
"settings": {
"index": {
"creation_date": "1527377274366",
"number_of_shards": "5",
"number_of_replicas": "1",
"uuid": "6QfKqbbVQ0Gbsqkq7WZJ2g",
"version": {
"created": "6020299"
},
"provided_name": "index_name"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
查看此索引下的所有数据
curl -H 'Content-Type: application/json' -X GET https://localhost:9200/index_name/_search?pretty
Run Code Online (Sandbox Code Playgroud)
如果您尚未将太多数据索引到索引中,则可以在要调试的字段上使用术语构面查询来查看令牌及其频率:
curl -XDELETE 'http://localhost:9200/test-idx'
echo
curl -XPUT 'http://localhost:9200/test-idx' -d '
{
"settings": {
"index.number_of_shards" : 1,
"index.number_of_replicas": 0
},
"mappings": {
"doc": {
"properties": {
"message": {"type": "string", "analyzer": "snowball"}
}
}
}
}'
echo
curl -XPUT 'http://localhost:9200/test-idx/doc/1' -d '
{
"message": "How is this going to be indexed?"
}
'
echo
curl -XPOST 'http://localhost:9200/test-idx/_refresh'
echo
curl -XGET 'http://localhost:9200/test-idx/doc/_search?pretty=true&search_type=count' -d '{
"query": {
"match": {
"_id": "1"
}
},
"facets": {
"tokens": {
"terms": {
"field": "message"
}
}
}
}
'
echo
Run Code Online (Sandbox Code Playgroud)
我可以推荐Elasticvue,它是现代的、免费的和开源的。它允许通过浏览器插件非常轻松地访问您的 ES 实例(支持 Firefox、Chrome、Edge)。但也有进一步的方法。
只要确保你在elasticsearch.yml中设置了cors 值就行了。
| 归档时间: |
|
| 查看次数: |
65277 次 |
| 最近记录: |