弹性搜索:如何查看索引数据(Elastic Search: how to see the indexed data)

系统教程 行业动态 更新时间:2024-06-14 17:00:14
弹性搜索:如何查看索引数据(Elastic Search: how to see the indexed data)

我有一个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-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.

更多推荐

本文发布于:2023-04-18 00:59:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/48ddeabdecbc9dac1868d232ad4b6286.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:弹性   索引   数据   Elastic   indexed

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!