我有一个ElasticSearch和Rails的问题,由于attr_protected,一些数据没有正确索引。 Elastic Search在哪里存储索引数据? 检查实际的索引数据是否错误将是有用的。
使用Tire.index('models').mapping检查Tire.index('models').mapping并不帮助,列出了该字段。
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.
最满意答案
探索ElasticSearch集群的最简单方式可能是使用弹性搜索头 。
您可以通过以下方式进行安装:
cd elasticsearch/ ./bin/plugin -install mobz/elasticsearch-head然后(假设ElasticSearch已经在本地机器上运行),打开一个浏览器窗口:
http://localhost:9200/_plugin/head/
或者,您只需使用命令行中的curl ,例如:
检查索引的映射:
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" : { "terms" : { "size" : 50, "field" : "foo" } } } }更多在这里: http : //www.elasticsearch.org/guide
更新:感觉插件在Marvel
到目前为止,为Elasticsearch编写curl -style命令的最简单的方法是Marvel中的Sense插件 。
它带有源突出显示,漂亮的缩进和自动填充。
注意: 感觉原来是一个独立的chrome插件,但现在是Marvel项目的一部分 。
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-headThen (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.
更多推荐
发布评论