# How do element-based array query?

**URL:** <https://discuss.elastic.co/t/how-do-element-based-array-query/23307>\
**Category:** Elasticsearch\
**Created:** [April 18, 2015, 2:43pm UTC](https://discuss.elastic.co/t/how-do-element-based-array-query/23307 "2015-04-18T14:43:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![terrasacer](https://avatars.discourse-cdn.com/v4/letter/t/ecd19e/32.png) [@terrasacer](https://discuss.elastic.co/u/terrasacer)\
**Post date:** [April 18, 2015, 2:43pm UTC](https://discuss.elastic.co/t/how-do-element-based-array-query/23307/1 "2015-04-18T14:43:04Z")

</div>

Hi guys,

My problem succinctly  
POST tweet/test  
{

```
"name": "Stefan",

"address": ["China street",

       "Englang country"]

```

}

POST tweet/test  
{

```
"name": "Heroku",

"address": ["bla bla street",

       "China country"]

```

}

Response

{  
"took": 1,

"timed\_out": false,  
"\_shards": {  
"total": 5,  
"successful": 5,  
"failed": 0  
},  
"hits": {  
"total": 2,  
"max\_score": 0.15342641,  
"hits": [  
{  
"\_index": "tweet",  
"\_type": "test",  
"\_id": "AUzM7tcIO39NAgkFq0jl",  
"\_score": 0.15342641,  
"\_source": {  
"name": "Heroku",  
"address": [  
"China street",  
"Englang country"  
]  
}  
},  
{  
"\_index": "tweet",  
"\_type": "test",  
"\_id": "AUzM7w2kO39NAgkFq0jm",  
"\_score": 0.13424811,  
"\_source": {  
"name": "Heroku",  
"address": [  
"bla bla street",  
"China country"  
]  
}  
}  
]  
}  
}

How do I get to return only the second document without changing the map?

Best.

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a864e2a8-c713-49b0-b37a-3cc460b5d750%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a864e2a8-c713-49b0-b37a-3cc460b5d750%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![terrasacer](https://avatars.discourse-cdn.com/v4/letter/t/ecd19e/32.png) [@terrasacer](https://discuss.elastic.co/u/terrasacer)\
**Post date:** [April 18, 2015, 2:45pm UTC](https://discuss.elastic.co/t/how-do-element-based-array-query/23307/2 "2015-04-18T14:45:39Z")

</div>

I'm sorry, I forgot the query 🙂

GET tweet/\_search

{

```
"query": {

   "query_string": {

      "default_field": "address",

      "query": "China country",

      "default_operator": "AND"

   }

```

}

}

On Saturday, April 18, 2015 at 5:43:04 PM UTC+3, Terra Sacer wrote:

> Hi guys,
> 
> My problem succinctly  
> POST tweet/test  
> {
> 
> ```
> "name": "Stefan",
> 
> "address": ["China street",
> 
> "Englang country"]
> 
> ```
> 
> }
> 
> POST tweet/test  
> {
> 
> ```
> "name": "Heroku",
> 
> "address": ["bla bla street",
> 
> "China country"]
> 
> ```
> 
> }
> 
> Response
> 
> {  
> "took": 1,
> 
> "timed\_out": false,  
> "\_shards": {  
> "total": 5,  
> "successful": 5,  
> "failed": 0  
> },  
> "hits": {  
> "total": 2,  
> "max\_score": 0.15342641,  
> "hits": [  
> {  
> "\_index": "tweet",  
> "\_type": "test",  
> "\_id": "AUzM7tcIO39NAgkFq0jl",  
> "\_score": 0.15342641,  
> "\_source": {  
> "name": "Heroku",  
> "address": [  
> "China street",  
> "Englang country"  
> ]  
> }  
> },  
> {  
> "\_index": "tweet",  
> "\_type": "test",  
> "\_id": "AUzM7w2kO39NAgkFq0jm",  
> "\_score": 0.13424811,  
> "\_source": {  
> "name": "Heroku",  
> "address": [  
> "bla bla street",  
> "China country"  
> ]  
> }  
> }  
> ]  
> }  
> }
> 
> How do I get to return only the second document without changing the map?
> 
> Best.

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a1a0c41c-67f3-4e75-9fa3-f06005bb80be%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a1a0c41c-67f3-4e75-9fa3-f06005bb80be%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:18am UTC](https://discuss.elastic.co/t/how-do-element-based-array-query/23307/3 "2017-07-06T00:18:55Z")

</div>


