回答(16)
2 years ago
如果你想清理索尔索引 -
你可以开火http网址 -
http://host:port/solr/[core name]/update?stream.body=*:*&commit=true
(将 [core name] 替换为要从中删除的核心的名称) . 或者如果发布数据xml数据,请使用此方法:
*:*
请务必使用 commit=true 提交更改
但是,清除hbase数据并不是很清楚 .
2 years ago
我已经使用此请求删除了所有记录,但有时需要提交此记录 .
为此,请在您的请求中添加 &commit=true :
http://host:port/solr/core/update?stream.body=*:*&commit=true
2 years ago
您可以使用以下命令删除 . 在delete by query命令中使用"match all docs"查询:
'*:*
您还必须在运行删除后提交,以清空索引,运行以下两个命令:
curl http://localhost:8983/solr/update --data '*:*' -H 'Content-type:text/xml; charset=utf-8'
curl http://localhost:8983/solr/update --data '' -H 'Content-type:text/xml; charset=utf-8'
另一种策略是在浏览器中添加两个书签:
http://localhost:8983/solr/update?stream.body=*:*
http://localhost:8983/solr/update?stream.body=
2 years ago
如果你想通过SolrJ删除Solr中的所有数据,请执行以下操作 .
public static void deleteAllSolrData() {
HttpSolrServer solr = new HttpSolrServer("http://localhost:8080/solr/core/");
try {
solr.deleteByQuery("*:*");
} catch (SolrServerException e) {
throw new RuntimeException("Failed to delete data in Solr. "
+ e.getMessage(), e);
} catch (IOException e) {
throw new RuntimeException("Failed to delete data in Solr. "
+ e.getMessage(), e);
}
}
如果要删除HBase中的所有数据,请执行以下操作 .
public static void deleteHBaseTable(String tableName, Configuration conf) {
HBaseAdmin admin = null;
try {
admin = new HBaseAdmin(conf);
admin.disableTable(tableName);
admin.deleteTable(tableName);
} catch (MasterNotRunningException e) {
throw new RuntimeException("Unable to delete the table " + tableName
+ ". The actual exception is: " + e.getMessage(), e);
} catch (ZooKeeperConnectionException e) {
throw new RuntimeException("Unable to delete the table " + tableName
+ ". The actual exception is: " + e.getMessage(), e);
} catch (IOException e) {
throw new RuntimeException("Unable to delete the table " + tableName
+ ". The actual exception is: " + e.getMessage(), e);
} finally {
close(admin);
}
}
2 years ago
发布json数据(例如卷曲)
curl -X POST -H 'Content-Type: application/json' \
'http://:/solr//update?commit=true' \
-d '{ "delete": {"query":"*:*"} }'
2 years ago
在delete by query命令中使用"match all docs"查询:
您还必须在运行删除后提交,以清空索引,运行以下两个命令:
curl http://localhost:8983/solr/update --data '*:*' -H 'Content-type:text/xml; charset=utf-8'
curl http://localhost:8983/solr/update --data '' -H 'Content-type:text/xml; charset=utf-8'
2 years ago
我来到这里寻找使用SolrNet从solr实例中删除所有文件到.Net框架 . 这是我能够做到的:
Startup.Init("http://localhost:8081/solr");
ISolrOperations solr =
ServiceLocator.Current.GetInstance>();
SolrQuery sq = new SolrQuery("*:*");
solr.Delete(sq);
solr.Commit();
这已经清除了所有文件 . (我不确定这是否可以恢复,我正处于Solr的学习和测试阶段,所以请在使用此代码之前考虑备份)
2 years ago
在浏览器中触发它
http://localhost:8983/solr/update?stream.body=*:*&commit=true 此命令将删除solr中索引中的所有文档
2 years ago
我用这个查询删除了所有记录 .
http://host/solr/core-name/update?stream.body=%3Cdelete%3E%3Cquery%3E*:*%3C/query%3E%3C/delete%3E&commit=true
2 years ago
如果您需要清理所有数据,重新创建集合可能会更快,例如
solrctl --zk localhost:2181/solr collection --delete
solrctl --zk localhost:2181/solr collection --create -s 1
2 years ago
当我从cygwin终端运行时,上面的卷曲示例都失败了 . 当我运行脚本示例时,有这样的错误 .
curl http://192.168.2.20:7773/solr/CORE1/update --data '*:*' -H 'Content-type:text/xml; charset=utf-8'
01
curl http://192.168.1.2:7773/solr/CORE1/update --data-binary '' -H 'Content-type:text/xml; charset=utf-8'
4002Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,0]400
我需要在核心名称的循环中使用delete来将它们全部擦除到项目中 .
下面的查询在Cygwin终端脚本中为我工作 .
curl http://192.168.1.2:7773/hpi/CORE1/update?stream.body=*:*&commit=true
01
这一行使数据消失,变化持续存在 .
2 years ago
从命令行使用:
bin/post -c core_name -type text/xml -out yes -d $'*:*'
2 years ago
清除Solr索引时,还应该在运行delete-all查询后进行提交和优化 . 需要完整的步骤(curl就是你所需要的):http://www.alphadevx.com/a/365-Clearing-a-Solr-search-index
2 years ago
我创建了一个JavaScript书签,在Solr Admin UI中添加了删除链接
javascript: (function() {
var str, $a, new_href, href, upd_str = 'update?stream.body=*:*&commit=true';
$a = $('#result a#url');
href = $a.attr('href');
str = href.match('.+solr\/.+\/(.*)')[1];
new_href = href.replace(str, upd_str);
$('#result').prepend('DELETE ALL ' + new_href + '');
})();
2 years ago
如果你正在使用Cloudera 5.x,那么在本文档中提到Lily也保持实时更新和删除 .
由于HBase对HBase表格单元应用插入,更新和删除,因此索引器使用标准HBase复制使Solr与HBase表内容保持一致 .
不确定是否也支持 truncate 'hTable' .
否则,您可以创建一个触发器或服务来清除Solr和HBase上特定事件或任何事件的数据 .
2 years ago
Solr我不确定但您可以使用truncate命令从hbase删除所有数据,如下所示:
truncate 'table_name'
它将删除hbase表中的所有行键 .