Solr4.1无法删除超过30天的文档
我正在运行Solr4.1。 我有一个版本字段,但我不知道如何通过查询删除时间。我的模式中没有任何字段中有我可以看到的时间戳 我要做的是运行一个查询,删除所有超过30天的文档 我在网上找到的东西都试过了Solr4.1无法删除超过30天的文档,solr,Solr,我正在运行Solr4.1。 我有一个版本字段,但我不知道如何通过查询删除时间。我的模式中没有任何字段中有我可以看到的时间戳 我要做的是运行一个查询,删除所有超过30天的文档 我在网上找到的东西都试过了 curl http://localhost:8983/solr/update?commit=true -H "Content-Type: text/xml" --data-binary '<delete><query>_version_:[* TO NOW-60DAYS]
curl http://localhost:8983/solr/update?commit=true -H "Content-Type: text/xml" --data-binary '<delete><query>_version_:[* TO NOW-60DAYS] </query></delete>'
curl http://localhost:8983/solr/update?commit=true -H "Content-Type: text/xml" --data-binary '<delete><query>timestamp:[* TO NOW-60DAYS] </query></delete>'
curl http://localhost:8983/solr/update?commit=true -H "Content-Type: text/xml" --data-binary '<delete><query>createTime:[* TO NOW-60DAYS] </query></delete>'
curlhttp://localhost:8983/solr/update?commit=true -H“内容类型:text/xml”--数据二进制“\u版本:[*到现在-60天”
卷曲http://localhost:8983/solr/update?commit=true -H“内容类型:text/xml”--数据二进制“时间戳:[*到现在-60天]”
卷曲http://localhost:8983/solr/update?commit=true -H“内容类型:text/xml”--数据二进制“createTime:[*至今-60天”
其他的工作很好
curl http://localhost:8983/solr/update?commit=true -H "Content-Type: text/xml" --data-binary '<delete><query>field:value</query></delete>'
curlhttp://localhost:8983/solr/update?commit=true -H“内容类型:text/xml”--数据二进制“字段:值”
您可以启用schema.xml中包含的时间戳字段,只需注释掉它。每次将文档插入索引时,该字段将自动填充当前日期时间。在schema.xml中查找以下内容:
<!-- Uncommenting the following will create a "timestamp" field using
a default value of "NOW" to indicate when each document was indexed.
-->
<!--
<field name="timestamp" type="date" indexed="true" stored="true"
default="NOW" multiValued="false"/>
-->
您需要为文档重新编制索引,以便设置此值