thi*_*ice 9 solr elasticsearch
我正在考虑使用ElasticSearch或solr进行"监禁"搜索结果.由于被判入狱,我希望将数据集分开以用于安全目的等.
据我所知,这可以通过使用solr的多核配置来实现 - 有没有办法使用ElasticSearch以高效的'实例化'方式隔离索引/数据?
在ElasticSearch中,您可以通过索引到单独的索引来分隔数据,然后将查询限制为特定索引.
例如,如果你有两个索引,'foo'和'bar'运行:
% curl -XGET http://localhost:9200/_search?q=*:*
Run Code Online (Sandbox Code Playgroud)
将搜索整个群集,同时:
% curl -XGET http://localhost:9200/foo/_search?q=*:*
Run Code Online (Sandbox Code Playgroud)
将只搜索'foo'索引.
如果使用以下内容创建索引"test",也可以按类型分隔数据:
% 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" }
}
}
}
}'
Run Code Online (Sandbox Code Playgroud)
您可以通过使用查询指定类型来仅搜索"type1"文档:
% curl -XGET http://localhost:9200/test/type1/_search?q=*:*
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
951 次 |
| 最近记录: |