[英]Delete indexes in ElasticSearch correctly
When I delete some data from the database Elastic Search "not updated" then give the restart of their service to pick up the changes. 当我从数据库“ Elastic Search ”中删除一些数据“未更新”时,请重新启动其服务以获取更改。 However I want to do it right and delete the data. 但是我想正确地做并删除数据。
My code correctly deletes all indexes but when I do a search it appears terms as result with count = 0
我的代码正确删除了所有索引,但是当我执行搜索时,其结果显示为count = 0
I want to delete and don't appear in the search , how do it? 我想删除但不出现在搜索中 ,怎么办?
My code 我的密码
try {
String formatValue = URLEncoder.encode(veiculo, "UTF-8");
Request.Delete("http://" + PropertiesSingleton.getValue("es.host") + ":9200/oknok/base_gerenciada/_query?q=spec_veiculo:" + formatValue + "&default_operator=AND")
.useExpectContinue()
.version(HttpVersion.HTTP_1_1)
.execute().returnContent().asString();
} catch (IOException e) {
Log.error(this, "Erro ao remover do Elastic Search.", e);
}
My filter in search 我的搜索过滤器
{"from": 0, "size": 0, "query":{"bool":{"must":[{"term":{"last":true}}]}}, "facets": {"filters": {"terms": {"field": "spec_veiculo.raw", "all_terms": true,"size" : 999999, "order": "term"}}}}
Search result 搜索结果
{"took":4,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":8375,"max_score":0.0,"hits":[]},"facets":{"filters":{"_type":"terms","missing":0,"total":8375,"other":0,"terms":[{"term":"Abril - Arquitetura & Construção","count":67},{"term":"Abril - Aventuras na História","count":67},{"term":"Abril - Bebe.com.br","count":67},{"term":"Abril - Boa Forma","count":67},{"term":"Abril - Bons Fluidos","count":67},{"term":"Abril - Capricho","count":67},{"term":"Abril - Casa Claudia","count":67},{"term":"Abril - Casa.com.br","count":67},{"term":"Abril - Claudia","count":67},{"term":"Abril - Contigo!","count":0},{"term":"Abril - Elle","count":67},{"term":"Abril - Estilo","count":67},{"term":"Abril - Exame","count":67},{"term":"Abril - Exame PME","count":67},{"term":"Abril - Gestão Escolar","count":67},{"term":"Abril - Guia Quatro Rodas","count":67},{"term":"Abril - Guia do Estudante","count":67},{"term":"Abril - Hotel Pro","count":67},{"term":"Abril - Info","count":67} (...)
Try out your delete code using match phrase . 尝试使用匹配词组删除代码。
If you already know the id
of the document
you are going to delete, try deleting using the id of document. 如果你已经知道的id
中的document
你要删除,请尝试使用的文件的ID删除。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.