Elastic Search: how to see the indexed data

后端 未结 8 1467
深忆病人
深忆病人 2020-12-22 19:02

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

8条回答
  •  一整个雨季
    2020-12-22 19:10

    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.

提交回复
热议问题