Get count of deleted records by input query

Hi All,

I executing query to delete records from ES, below is the code for the same.

DeleteByQueryRequestBuilder dbqb = client
.prepareDeleteByQuery("index").setQuery(qb);

DeleteByQueryResponse deleteByQueryResponse = dbqb.execute()
.actionGet();

The query is working fine, but not returning the count of deleted records.

Please suggest some way through which we can find the number of deleted
records using the same query we used for deletion.

Thanks,
Ankit Jain

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

I'm also facing the same problem of retrieving the numbers of records when
multiple records are deleted.

Is there any support for Elastic Search for this?

Any help will be greatly appreciated.

Thanks,
Saurabh

On Sunday, May 26, 2013 10:00:41 AM UTC+5:30, Ankit Jain wrote:

Hi All,

I executing query to delete records from ES, below is the code for the
same.

DeleteByQueryRequestBuilder dbqb = client
.prepareDeleteByQuery("index").setQuery(qb);

DeleteByQueryResponse deleteByQueryResponse = dbqb.execute()
.actionGet();

The query is working fine, but not returning the count of deleted records.

Please suggest some way through which we can find the number of deleted
records using the same query we used for deletion.

Thanks,
Ankit Jain

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

There is no support for this functionality because Lucene does not provide
it.

Deleting a document in Lucene only marks a document as deleted in the index
and it does not get purged until a merge occurs. The count is unknown until
the merge actually happens.

--
Ivan

On Mon, May 27, 2013 at 4:26 AM, Saurabh saurabh113@gmail.com wrote:

I'm also facing the same problem of retrieving the numbers of records when
multiple records are deleted.

Is there any support for Elastic Search for this?

Any help will be greatly appreciated.

Thanks,
Saurabh

On Sunday, May 26, 2013 10:00:41 AM UTC+5:30, Ankit Jain wrote:

Hi All,

I executing query to delete records from ES, below is the code for the
same.

DeleteByQueryRequestBuilder dbqb = client
.prepareDeleteByQuery("index")**.setQuery(qb);

DeleteByQueryResponse deleteByQueryResponse = dbqb.execute()
.actionGet();

The query is working fine, but not returning the count of deleted records.

Please suggest some way through which we can find the number of deleted
records using the same query we used for deletion.

Thanks,
Ankit Jain

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

I'm wondering if this can be achieved by reading the "delete_total" index
status before and after your query
E.g.
curl -XGET 'http://localhost:9200/MyIndexName/_stats/indexing?pretty=true'

On Saturday, May 25, 2013 11:30:41 PM UTC-5, Ankit Jain wrote:

Hi All,

I executing query to delete records from ES, below is the code for the
same.

DeleteByQueryRequestBuilder dbqb = client
.prepareDeleteByQuery("index").setQuery(qb);

DeleteByQueryResponse deleteByQueryResponse = dbqb.execute()
.actionGet();

The query is working fine, but not returning the count of deleted records.

Please suggest some way through which we can find the number of deleted
records using the same query we used for deletion.

Thanks,
Ankit Jain

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

My opinion is that it makes sense to get back the total number of deleted documents by a DeleteByQuery API call. Open an issue?

About counting deleted Lucene docs (stats), beware of nested docs. They will be counted as well...

My 2 cents

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 29 mai 2013 à 02:36, Hariharan Vadivelu hariinfo@gmail.com a écrit :

I'm wondering if this can be achieved by reading the "delete_total" index status before and after your query
E.g.
curl -XGET 'http://localhost:9200/MyIndexName/_stats/indexing?pretty=true'

On Saturday, May 25, 2013 11:30:41 PM UTC-5, Ankit Jain wrote:

Hi All,

I executing query to delete records from ES, below is the code for the same.

DeleteByQueryRequestBuilder dbqb = client
.prepareDeleteByQuery("index").setQuery(qb);

DeleteByQueryResponse deleteByQueryResponse = dbqb.execute()
.actionGet();

The query is working fine, but not returning the count of deleted records.

Please suggest some way through which we can find the number of deleted records using the same query we used for deletion.

Thanks,
Ankit Jain

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

But, after digging a little more in source code, it sounds like Lucene does not provide it… :frowning:

David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 29 mai 2013 à 09:33, David Pilato david@pilato.fr a écrit :

My opinion is that it makes sense to get back the total number of deleted documents by a DeleteByQuery API call. Open an issue?

About counting deleted Lucene docs (stats), beware of nested docs. They will be counted as well...

My 2 cents

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 29 mai 2013 à 02:36, Hariharan Vadivelu hariinfo@gmail.com a écrit :

I'm wondering if this can be achieved by reading the "delete_total" index status before and after your query
E.g.
curl -XGET 'http://localhost:9200/MyIndexName/_stats/indexing?pretty=true'

On Saturday, May 25, 2013 11:30:41 PM UTC-5, Ankit Jain wrote:
Hi All,

I executing query to delete records from ES, below is the code for the same.

DeleteByQueryRequestBuilder dbqb = client
.prepareDeleteByQuery("index").setQuery(qb);

DeleteByQueryResponse deleteByQueryResponse = dbqb.execute()
.actionGet();

The query is working fine, but not returning the count of deleted records.

Please suggest some way through which we can find the number of deleted records using the same query we used for deletion.

Thanks,
Ankit Jain

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

First, fire up a count query
http://www.elasticsearch.org/guide/reference/api/count/ and then fire
the delete.
You won't get an exact number under all circumstances, but if you can
stop indexing/modification of the index for the time of the two
operations, it will work as expected.

Jörg

Am 26.05.13 06:30, schrieb Ankit Jain:

Please suggest some way through which we can find the number of
deleted records using the same query we used for deletion.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.