Does elasticsearch have the equivalent of 'cores' like in solr?

elasticsearch, solr

Solution

In ElasticSearch, you can separate data by indexing into separate indices, then limiting your query to a particular index.

For example, if you have two indices, 'foo' and 'bar' running:

% curl -XGET http://localhost:9200/_search?q=*:*

will search the entire cluster, while:

% curl -XGET http://localhost:9200/foo/_search?q=*:*

will search only the 'foo' index.

You can also separate data by types, if you create an index 'test' with the following:

% curl -XPOST http://localhost:9200/test -d '{
    "mappings" : {
        "type1" : {
            "_source" : { "enabled" : false },
            "properties" : {
                "field1" : { "type" : "string", "index" : "not_analyzed" }
            }
        },
        "type2" : {
            "_source" : { "enabled" : false },
            "properties" : {
                "field1" : { "type" : "string", "index" : "not_analyzed" }
            }
        }
    }
}'

You can search only the 'type1' documents by specifying the type with the query:

% curl -XGET http://localhost:9200/test/type1/_search?q=*:*

Problem

I'm eyeballing the use of ElasticSearch or solr for 'jailed' search results. By jailed I want to keep sets of data apart for security purposes, etc. As far as I can tell, this is possible by use of solr's multi core configuration - is there a way to isolate indexes/data in an efficient 'instancing' manner using ElasticSearch?

Original source