# Delete a specific pin without an id

**URL:** <https://discuss.elastic.co/t/delete-a-specific-pin-without-an-id/7156>\
**Category:** Elasticsearch\
**Created:** [March 28, 2012, 12:11am UTC](https://discuss.elastic.co/t/delete-a-specific-pin-without-an-id/7156 "2012-03-28T00:11:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![P\_V](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/p_v/32/2939_2.png) [@P\_V](https://discuss.elastic.co/u/P_V)\
**Post date:** [March 28, 2012, 12:11am UTC](https://discuss.elastic.co/t/delete-a-specific-pin-without-an-id/7156/1 "2012-03-28T00:11:06Z")

</div>

Hi Everyone,

I'm new to the elasticsearch and I'm with a doubt regarding geo  
location feature.

In a project that I'm working on, we have a few tests that are  
inserting a few locations to ElasticSearch with the following code:

final void index(final double latitude, final double longitude, final  
String indexName) {  
final XContentBuilder locationJson =  
ElasticsearchUtil.createJsonForLocation(latitude, longitude);  
client.prepareIndex(indexName,  
PIN).setSource(locationJson).setOperationThreaded(false).execute().actionGet(timeout);  
}

This works and we already have some tests searching inside a polygon  
but now I want to remove a specific "pin" (location) but the only api  
that I've available is the following:

client.prepareDelete("indexName", "pin",  
id).setOperationThreaded(false).execute().actionGet(timeout);

But I'm not inserting any id for my location.

How should I delete a specific pin without an id?

Thanks and sorry about the basic question..

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [March 28, 2012, 5:28am UTC](https://discuss.elastic.co/t/delete-a-specific-pin-without-an-id/7156/2 "2012-03-28T05:28:46Z")

</div>

You can always delete by query: client.prepareDeleteByQuery(...)

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

--  
Ivan

On Tue, Mar 27, 2012 at 5:11 PM, P.V. [pedro@elanross.com](mailto:pedro@elanross.com) wrote:

> Hi Everyone,
> 
> I'm new to the elasticsearch and I'm with a doubt regarding geo  
> location feature.
> 
> In a project that I'm working on, we have a few tests that are  
> inserting a few locations to Elasticsearch with the following code:
> 
> final void index(final double latitude, final double longitude, final  
> String indexName) {  
> final XContentBuilder locationJson =  
> ElasticsearchUtil.createJsonForLocation(latitude, longitude);  
> client.prepareIndex(indexName,  
> PIN).setSource(locationJson).setOperationThreaded(false).execute().actionGet(timeout);  
> }
> 
> This works and we already have some tests searching inside a polygon  
> but now I want to remove a specific "pin" (location) but the only api  
> that I've available is the following:
> 
> client.prepareDelete("indexName", "pin",  
> id).setOperationThreaded(false).execute().actionGet(timeout);
> 
> But I'm not inserting any id for my location.
> 
> How should I delete a specific pin without an id?
> 
> Thanks and sorry about the basic question..

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:34am UTC](https://discuss.elastic.co/t/delete-a-specific-pin-without-an-id/7156/3 "2017-07-06T03:34:30Z")

</div>

Closed on July 6, 2017, 3:34am UTC


