弹性搜索:如何查看索引数据 [英] Elastic Search: how to see the indexed data
问题描述
我有一个ElasticSearch和Rails的问题,由于attr_protected,一些数据没有正确索引。 Elastic Search在哪里存储索引数据?检查实际索引数据是否错误将是有用的。
使用 Tire.index('models')检查映射。映射
没有帮助,该字段被列出。
可能最简单的探索ElasticSearch集群的方法是使用弹性搜索头。
您可以通过以下方式进行安装:
cd elasticsearch /
./bin/plugin -install mobz / elasticsearch-head
然后(假设ElasticSearch已经在本地机器上运行),打开浏览器窗口: p>
http:// localhost:9200 / _plugin / head /
或者,您可以从命令行中使用 curl
,例如:
检查映射索引:
卷曲-XGET'http://127.0.0.1:9200/my_index/_mapping?pretty=1'
获取一些示例文档:
curl -XGET'http://127.0.0.1:9200/my_index/_search?pretty=1'
查看特定字段中存储的实际条款(即如何分析该字段):
curl - XGET'http://127.0.0.1:9200/my_index/_search?pretty=1'-d'
{
facets:{
my_terms:{
条款:{
size:50,
field:foo
}
}
}
}
更多在这里: http://www.elasticsearch.org/guide
更新: Marvel
到目前为止,最简单的写作方式 curl
奇迹中的Sense插件。
它带有源突出显示,漂亮缩进和自动填充。
注意:。
I had a problem with ElasticSearch and Rails, where some data was not indexed properly because of attr_protected. Where does Elastic Search store the indexed data? It would be useful to check if the actual indexed data is wrong.
Checking the mapping with Tire.index('models').mapping
does not help, the field is listed.
Probably the easiest way to explore your ElasticSearch cluster is to use elasticsearch-head.
You can install it by doing:
cd elasticsearch/
./bin/plugin -install mobz/elasticsearch-head
Then (assuming ElasticSearch is already running on your local machine), open a browser window to:
http://localhost:9200/_plugin/head/
Alternatively, you can just use curl
from the command line, eg:
Check the mapping for an index:
curl -XGET 'http://127.0.0.1:9200/my_index/_mapping?pretty=1'
Get some sample docs:
curl -XGET 'http://127.0.0.1:9200/my_index/_search?pretty=1'
See the actual terms stored in a particular field (ie how that field has been analyzed):
curl -XGET 'http://127.0.0.1:9200/my_index/_search?pretty=1' -d '
{
"facets" : {
"my_terms" : {
"terms" : {
"size" : 50,
"field" : "foo"
}
}
}
}
More available here: http://www.elasticsearch.org/guide
UPDATE : Sense plugin in Marvel
By far the easiest way of writing curl
-style commands for Elasticsearch is the Sense plugin in Marvel.
It comes with source highlighting, pretty indenting and autocomplete.
Note: Sense was originally a standalone chrome plugin but is now part of the Marvel project.
这篇关于弹性搜索:如何查看索引数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!