# ElasticSearch queries always return all the datas stored in the index

**URL:** <https://discuss.elastic.co/t/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index/18228>\
**Category:** Elasticsearch\
**Created:** [June 20, 2014, 9:06am UTC](https://discuss.elastic.co/t/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index/18228 "2014-06-20T09:06:32Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexandre\_Touret](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexandre_touret/32/1473_2.png) [@Alexandre\_Touret](https://discuss.elastic.co/u/Alexandre_Touret)\
**Post date:** [June 20, 2014, 9:06am UTC](https://discuss.elastic.co/t/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index/18228/1 "2014-06-20T09:06:32Z")

</div>

hello,

[https://stackoverflow.com/questions/24323480/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index#](https://stackoverflow.com/questions/24323480/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index#)

I'm trying to index and query an index store in ES 1.2. I both create and  
populate the index with the JAVA API using the transportclient api. I have  
the following mapping:

get /tp/carte/\_mapping{  
"tp": {  
"mappings": {  
"carte": {  
"properties": {  
"adherents": {  
"properties": {  
"birthday": {  
"type": "date",  
"format": "dateOptionalTime"  
},  
"firstname": {  
"type": "string"  
},  
"lastname": {  
"type": "string"  
}  
}  
},  
"dateEdition": {  
"type": "date",  
"format": "dateOptionalTime"  
}  
}  
}  
}  
}}

When I search ob object with the ID, it works fine but, when I try to query  
the content of one of my nested objects, _ES always returns all the objects  
stored in the index_. I also tried to create the objects manually with  
sense and I have the same behaviour.

Example of my insert

put /tp/carte/20454795{  
"dateEdition": "2014-06-01T22:00:00.000Z",  
"adherents": [  
{  
"birthday": "1958-05-05T23:00:00.000Z",  
"firstname": "ANDREW",  
"lastname": "DOE"  
},  
{  
"birthday": "1964-03-01T23:00:00.000Z",  
"firstname": "ROBERT",  
"lastname": "DOE"  
},  
{  
"birthday": "1989-02-27T23:00:00.000Z",  
"firstname": "DAVID",  
"lastname": "DOE"  
},  
{  
"birthday": "1990-12-11T23:00:00.000Z",  
"firstname": "JOHN",  
"lastname": "DOE"  
}  
]  
}

Finally, you could find below a query executed in sense

get /tp/carte/\_search{  
"query": {  
"bool": {  
"must": [  
{  
"match": {  
"adherents.lastname": {  
"query": "DOE"  
}  
}  
}  
]  
}  
}

How can I fix that ?

Thanks

Regards

Alexandre

--  
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/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 20, 2014, 9:11am UTC](https://discuss.elastic.co/t/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index/18228/2 "2014-06-20T09:11:51Z")

</div>

Hey Alexandre,

This is correct. You are searching for a carte which contains an adherent.  
Elasticsearch gives you a carte object as an answer. And elasticsearch gives you back exactly what you have indexed.

That being said, I think you could look at parent/child feature for that use case.  
Or you can have one carte object per adherent?

Makes sense?

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 20 juin 2014 à 11:06:40, Alexandre Touret (alexandre@touret.info) a écrit:

hello,

I'm trying to index and query an index store in ES 1.2. I both create and populate the index with the JAVA API using the transportclient api. I have the following mapping:

get /tp/carte/\_mapping  
{  
"tp": {  
"mappings": {  
"carte": {  
"properties": {  
"adherents": {  
"properties": {  
"birthday": {  
"type": "date",  
"format": "dateOptionalTime"  
},  
"firstname": {  
"type": "string"  
},  
"lastname": {  
"type": "string"  
}  
}  
},  
"dateEdition": {  
"type": "date",  
"format": "dateOptionalTime"  
}  
}  
}  
}  
}  
}

When I search ob object with the ID, it works fine but, when I try to query the content of one of my nested objects, ES always returns all the objects stored in the index. I also tried to create the objects manually with sense and I have the same behaviour.

Example of my insert

put /tp/carte/20454795  
{  
"dateEdition": "2014-06-01T22:00:00.000Z",  
"adherents": [  
{  
"birthday": "1958-05-05T23:00:00.000Z",  
"firstname": "ANDREW",  
"lastname": "DOE"  
},  
{  
"birthday": "1964-03-01T23:00:00.000Z",  
"firstname": "ROBERT",  
"lastname": "DOE"  
},  
{  
"birthday": "1989-02-27T23:00:00.000Z",  
"firstname": "DAVID",  
"lastname": "DOE"  
},  
{  
"birthday": "1990-12-11T23:00:00.000Z",  
"firstname": "JOHN",  
"lastname": "DOE"  
}  
]  
}

Finally, you could find below a query executed in sense

get /tp/carte/\_search  
{  
"query": {  
"bool": {  
"must": [  
{  
"match": {  
"adherents.lastname": {  
"query": "DOE"  
}  
}  
}  
]  
}  
}

How can I fix that ?

Thanks

Regards

Alexandre

--  
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/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/etPan.53a3fad7.5bd062c2.198d%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53a3fad7.5bd062c2.198d%40MacBook-Air-de-David.local).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Alexandre\_Touret](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexandre_touret/32/1473_2.png) [@Alexandre\_Touret](https://discuss.elastic.co/u/Alexandre_Touret)\
**Post date:** [June 20, 2014, 9:19am UTC](https://discuss.elastic.co/t/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index/18228/3 "2014-06-20T09:19:19Z")

</div>

Hello,  
thanks for your response

When I add an other carte

put /tp/carte/20450813  
{  
"dateEdition": "2014-06-01T22:00:00.000Z",  
"adherents": [  
{  
"birthday": "1963-03-22T23:00:00.000Z",  
"firstname": "FLORENCE",  
"lastname": "SMITH"  
},  
{  
"birthday": "2001-10-12T22:00:00.000Z",  
"firstname": "M ANGELO",  
"lastname": "SMITH" },  
{  
"birthday": "2003-07-30T22:00:00.000Z",  
"firstname": "M LILI",  
"lastname": "SMITH"  
}  
]  
}

and I run the query described above, I have both of the two 'carte'

Is it "normal" ?  
Do you have an example or a link to illustrate the parent/child feature ?

Thanks

Le vendredi 20 juin 2014 11:12:04 UTC+2, David Pilato a écrit :

> Hey Alexandre,
> 
> This is correct. You are searching for a carte which contains an adherent.  
> Elasticsearch gives you a carte object as an answer. And elasticsearch  
> gives you back exactly what you have indexed.
> 
> That being said, I think you could look at parent/child feature for that  
> use case.  
> Or you can have one carte object per adherent?
> 
> Makes sense?
> 
> --  
> _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> 
> Le 20 juin 2014 à 11:06:40, Alexandre Touret (alex...@touret.info  
> \<javascript:\>) a écrit:
> 
> hello,
> 
> [https://stackoverflow.com/questions/24323480/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index#](https://stackoverflow.com/questions/24323480/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index#)
> 
> I'm trying to index and query an index store in ES 1.2. I both create and  
> populate the index with the JAVA API using the transportclient api. I have  
> the following mapping:
> 
> get /tp/carte/\_mapping{  
> "tp": {  
> "mappings": {  
> "carte": {  
> "properties": {  
> "adherents": {  
> "properties": {  
> "birthday": {  
> "type": "date",  
> "format": "dateOptionalTime"  
> },  
> "firstname": {  
> "type": "string"  
> },  
> "lastname": {  
> "type": "string"  
> }  
> }  
> },  
> "dateEdition": {  
> "type": "date",  
> "format": "dateOptionalTime"  
> }  
> }  
> }  
> }  
> }}
> 
> When I search ob object with the ID, it works fine but, when I try to  
> query the content of one of my nested objects, _ES always returns all the  
> objects stored in the index_. I also tried to create the objects manually  
> with sense and I have the same behaviour.
> 
> Example of my insert
> 
> put /tp/carte/20454795{  
> "dateEdition": "2014-06-01T22:00:00.000Z",  
> "adherents": [  
> {  
> "birthday": "1958-05-05T23:00:00.000Z",  
> "firstname": "ANDREW",  
> "lastname": "DOE"  
> },  
> {  
> "birthday": "1964-03-01T23:00:00.000Z",  
> "firstname": "ROBERT",  
> "lastname": "DOE"  
> },  
> {  
> "birthday": "1989-02-27T23:00:00.000Z",  
> "firstname": "DAVID",  
> "lastname": "DOE"  
> },  
> {  
> "birthday": "1990-12-11T23:00:00.000Z",  
> "firstname": "JOHN",  
> "lastname": "DOE"  
> }  
> ]  
> }
> 
> Finally, you could find below a query executed in sense
> 
> get /tp/carte/\_search{  
> "query": {  
> "bool": {  
> "must": [  
> {  
> "match": {  
> "adherents.lastname": {  
> "query": "DOE"  
> }  
> }  
> }  
> ]  
> }  
> }
> 
> How can I fix that ?
> 
> Thanks
> 
> Regards
> 
> Alexandre
> 
> --  
> 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/6abc6213-b1f7-4145-9573-49401e720029%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6abc6213-b1f7-4145-9573-49401e720029%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 20, 2014, 9:24am UTC](https://discuss.elastic.co/t/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index/18228/4 "2014-06-20T09:24:18Z")

</div>

Searching for DOE gives you that answer?  
If so, it's not normal IMHO. You should try to reproduce it with a full SENSE script recreation so we can replay it and help you from here.

See [http://www.elasticsearch.org/help/](http://www.elasticsearch.org/help/) for information.

About parent child, you could read this: [http://www.elasticsearch.org/blog/managing-relations-inside-elasticsearch/](http://www.elasticsearch.org/blog/managing-relations-inside-elasticsearch/)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 20 juin 2014 à 11:19:23, Alexandre Touret (alexandre@touret.info) a écrit:

Hello,  
thanks for your response

When I add an other carte

put /tp/carte/20450813  
{  
"dateEdition": "2014-06-01T22:00:00.000Z",  
"adherents": [  
{  
"birthday": "1963-03-22T23:00:00.000Z",  
"firstname": "FLORENCE",  
"lastname": "SMITH"  
},  
{  
"birthday": "2001-10-12T22:00:00.000Z",  
"firstname": "M ANGELO",  
"lastname": "SMITH" },  
{  
"birthday": "2003-07-30T22:00:00.000Z",  
"firstname": "M LILI",  
"lastname": "SMITH"  
}  
]  
}

and I run the query described above, I have both of the two 'carte'

Is it "normal" ?  
Do you have an example or a link to illustrate the parent/child feature ?

Thanks

Le vendredi 20 juin 2014 11:12:04 UTC+2, David Pilato a écrit :  
Hey Alexandre,

This is correct. You are searching for a carte which contains an adherent.  
Elasticsearch gives you a carte object as an answer. And elasticsearch gives you back exactly what you have indexed.

That being said, I think you could look at parent/child feature for that use case.  
Or you can have one carte object per adherent?

Makes sense?

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 20 juin 2014 à 11:06:40, Alexandre Touret (alex...@touret.info) a écrit:

hello,

I'm trying to index and query an index store in ES 1.2. I both create and populate the index with the JAVA API using the transportclient api. I have the following mapping:

get /tp/carte/\_mapping  
{  
"tp": {  
"mappings": {  
"carte": {  
"properties": {  
"adherents": {  
"properties": {  
"birthday": {  
"type": "date",  
"format": "dateOptionalTime"  
},  
"firstname": {  
"type": "string"  
},  
"lastname": {  
"type": "string"  
}  
}  
},  
"dateEdition": {  
"type": "date",  
"format": "dateOptionalTime"  
}  
}  
}  
}  
}  
}

When I search ob object with the ID, it works fine but, when I try to query the content of one of my nested objects, ES always returns all the objects stored in the index. I also tried to create the objects manually with sense and I have the same behaviour.

Example of my insert

put /tp/carte/20454795  
{  
"dateEdition": "2014-06-01T22:00:00.000Z",  
"adherents": [  
{  
"birthday": "1958-05-05T23:00:00.000Z",  
"firstname": "ANDREW",  
"lastname": "DOE"  
},  
{  
"birthday": "1964-03-01T23:00:00.000Z",  
"firstname": "ROBERT",  
"lastname": "DOE"  
},  
{  
"birthday": "1989-02-27T23:00:00.000Z",  
"firstname": "DAVID",  
"lastname": "DOE"  
},  
{  
"birthday": "1990-12-11T23:00:00.000Z",  
"firstname": "JOHN",  
"lastname": "DOE"  
}  
]  
}

Finally, you could find below a query executed in sense

get /tp/carte/\_search  
{  
"query": {  
"bool": {  
"must": [  
{  
"match": {  
"adherents.lastname": {  
"query": "DOE"  
}  
}  
}  
]  
}  
}

How can I fix that ?

Thanks

Regards

Alexandre

## -- 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com). To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com). For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

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/6abc6213-b1f7-4145-9573-49401e720029%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6abc6213-b1f7-4145-9573-49401e720029%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/etPan.53a3fdc2.1f16e9e8.198d%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53a3fdc2.1f16e9e8.198d%40MacBook-Air-de-David.local).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Alexandre\_Touret](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexandre_touret/32/1473_2.png) [@Alexandre\_Touret](https://discuss.elastic.co/u/Alexandre_Touret)\
**Post date:** [June 20, 2014, 9:26am UTC](https://discuss.elastic.co/t/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index/18228/5 "2014-06-20T09:26:58Z")

</div>

Yes  
My request for doe always return that answer

Le vendredi 20 juin 2014 11:24:33 UTC+2, David Pilato a écrit :

> Searching for DOE gives you that answer?  
> If so, it's not normal IMHO. You should try to reproduce it with a full  
> SENSE script recreation so we can replay it and help you from here.
> 
> See [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help/) for information.
> 
> About parent child, you could read this:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/blog/managing-relations-inside-elasticsearch/)
> 
> --  
> _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> 
> Le 20 juin 2014 à 11:19:23, Alexandre Touret (alex...@touret.info  
> \<javascript:\>) a écrit:
> 
> Hello,  
> thanks for your response
> 
> When I add an other carte
> 
> put /tp/carte/20450813  
> {  
> "dateEdition": "2014-06-01T22:00:00.000Z",  
> "adherents": [  
> {  
> "birthday": "1963-03-22T23:00:00.000Z",  
> "firstname": "FLORENCE",  
> "lastname": "SMITH"  
> },  
> {  
> "birthday": "2001-10-12T22:00:00.000Z",  
> "firstname": "M ANGELO",  
> "lastname": "SMITH" },  
> {  
> "birthday": "2003-07-30T22:00:00.000Z",  
> "firstname": "M LILI",  
> "lastname": "SMITH"  
> }  
> ]  
> }
> 
> and I run the query described above, I have both of the two 'carte'
> 
> Is it "normal" ?  
> Do you have an example or a link to illustrate the parent/child feature ?
> 
> Thanks
> 
> Le vendredi 20 juin 2014 11:12:04 UTC+2, David Pilato a écrit :
> 
> > Hey Alexandre,
> > 
> > This is correct. You are searching for a carte which contains an  
> > adherent.  
> > Elasticsearch gives you a carte object as an answer. And elasticsearch  
> > gives you back exactly what you have indexed.
> > 
> > That being said, I think you could look at parent/child feature for that  
> > use case.  
> > Or you can have one carte object per adherent?
> > 
> > Makes sense?
> > 
> > ```
> > -- 
> > 
> > ```
> > 
> > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > 
> > Le 20 juin 2014 à 11:06:40, Alexandre Touret (alex...@touret.info) a  
> > écrit:
> > 
> > hello,
> > 
> > [https://stackoverflow.com/questions/24323480/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index#](https://stackoverflow.com/questions/24323480/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index#)
> > 
> > I'm trying to index and query an index store in ES 1.2. I both create and  
> > populate the index with the JAVA API using the transportclient api. I have  
> > the following mapping:
> > 
> > get /tp/carte/\_mapping{  
> > "tp": {  
> > "mappings": {  
> > "carte": {  
> > "properties": {  
> > "adherents": {  
> > "properties": {  
> > "birthday": {  
> > "type": "date",  
> > "format": "dateOptionalTime"  
> > },  
> > "firstname": {  
> > "type": "string"  
> > },  
> > "lastname": {  
> > "type": "string"  
> > }  
> > }  
> > },  
> > "dateEdition": {  
> > "type": "date",  
> > "format": "dateOptionalTime"  
> > }  
> > }  
> > }  
> > }  
> > }}
> > 
> > When I search ob object with the ID, it works fine but, when I try to  
> > query the content of one of my nested objects, _ES always returns all  
> > the objects stored in the index_. I also tried to create the objects  
> > manually with sense and I have the same behaviour.
> > 
> > Example of my insert
> > 
> > put /tp/carte/20454795{  
> > "dateEdition": "2014-06-01T22:00:00.000Z",  
> > "adherents": [  
> > {  
> > "birthday": "1958-05-05T23:00:00.000Z",  
> > "firstname": "ANDREW",  
> > "lastname": "DOE"  
> > },  
> > {  
> > "birthday": "1964-03-01T23:00:00.000Z",  
> > "firstname": "ROBERT",  
> > "lastname": "DOE"  
> > },  
> > {  
> > "birthday": "1989-02-27T23:00:00.000Z",  
> > "firstname": "DAVID",  
> > "lastname": "DOE"  
> > },  
> > {  
> > "birthday": "1990-12-11T23:00:00.000Z",  
> > "firstname": "JOHN",  
> > "lastname": "DOE"  
> > }  
> > ]  
> > }
> > 
> > Finally, you could find below a query executed in sense
> > 
> > get /tp/carte/\_search{  
> > "query": {  
> > "bool": {  
> > "must": [  
> > {  
> > "match": {  
> > "adherents.lastname": {  
> > "query": "DOE"  
> > }  
> > }  
> > }  
> > ]  
> > }  
> > }
> > 
> > How can I fix that ?
> > 
> > Thanks
> > 
> > Regards
> > 
> > Alexandre
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/6abc6213-b1f7-4145-9573-49401e720029%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6abc6213-b1f7-4145-9573-49401e720029%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/6abc6213-b1f7-4145-9573-49401e720029%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/6abc6213-b1f7-4145-9573-49401e720029%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/e399b978-4d27-43f7-a294-fc2b1033e438%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e399b978-4d27-43f7-a294-fc2b1033e438%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Cedric\_Hourcade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cedric_hourcade/32/1451_2.png) [@Cedric\_Hourcade](https://discuss.elastic.co/u/Cedric_Hourcade)\
**Post date:** [June 20, 2014, 9:28am UTC](https://discuss.elastic.co/t/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index/18228/6 "2014-06-20T09:28:03Z")

</div>

It looks like you are doing a GET rather than a POST, if so your query  
content is ignored.

Cédric Hourcade  
[ced@wal.fr](mailto:ced@wal.fr)

On Fri, Jun 20, 2014 at 11:26 AM, Alexandre Touret [alexandre@touret.info](mailto:alexandre@touret.info)  
wrote:

> Yes  
> My request for doe always return that answer
> 
> Le vendredi 20 juin 2014 11:24:33 UTC+2, David Pilato a écrit :
> 
> > Searching for DOE gives you that answer?  
> > If so, it's not normal IMHO. You should try to reproduce it with a full  
> > SENSE script recreation so we can replay it and help you from here.
> > 
> > See [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help/) for information.
> > 
> > About parent child, you could read this: [http://www](http://www).  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://elasticsearch.org/blog/managing-relations-inside-elasticsearch/)
> > 
> > --  
> > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > 
> > Le 20 juin 2014 à 11:19:23, Alexandre Touret (alex...@touret.info) a  
> > écrit:
> > 
> > Hello,  
> > thanks for your response
> > 
> > When I add an other carte
> > 
> > put /tp/carte/20450813  
> > {  
> > "dateEdition": "2014-06-01T22:00:00.000Z",  
> > "adherents": [  
> > {  
> > "birthday": "1963-03-22T23:00:00.000Z",  
> > "firstname": "FLORENCE",  
> > "lastname": "SMITH"  
> > },  
> > {  
> > "birthday": "2001-10-12T22:00:00.000Z",  
> > "firstname": "M ANGELO",  
> > "lastname": "SMITH" },  
> > {  
> > "birthday": "2003-07-30T22:00:00.000Z",  
> > "firstname": "M LILI",  
> > "lastname": "SMITH"  
> > }  
> > ]  
> > }
> > 
> > and I run the query described above, I have both of the two 'carte'
> > 
> > Is it "normal" ?  
> > Do you have an example or a link to illustrate the parent/child feature ?
> > 
> > Thanks
> > 
> > Le vendredi 20 juin 2014 11:12:04 UTC+2, David Pilato a écrit :
> > 
> > > Hey Alexandre,
> > > 
> > > This is correct. You are searching for a carte which contains an  
> > > adherent.  
> > > Elasticsearch gives you a carte object as an answer. And elasticsearch  
> > > gives you back exactly what you have indexed.
> > > 
> > > That being said, I think you could look at parent/child feature for  
> > > that use case.  
> > > Or you can have one carte object per adherent?
> > > 
> > > Makes sense?
> > > 
> > > ```
> > > --
> > > 
> > > ```
> > > 
> > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > > 
> > > Le 20 juin 2014 à 11:06:40, Alexandre Touret (alex...@touret.info) a  
> > > écrit:
> > > 
> > > hello,
> > > 
> > > [https://stackoverflow.com/questions/24323480/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index#](https://stackoverflow.com/questions/24323480/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index#)
> > > 
> > > I'm trying to index and query an index store in ES 1.2. I both create  
> > > and populate the index with the JAVA API using the transportclient api. I  
> > > have the following mapping:
> > > 
> > > get /tp/carte/\_mapping{  
> > > "tp": {  
> > > "mappings": {  
> > > "carte": {  
> > > "properties": {  
> > > "adherents": {  
> > > "properties": {  
> > > "birthday": {  
> > > "type": "date",  
> > > "format": "dateOptionalTime"  
> > > },  
> > > "firstname": {  
> > > "type": "string"  
> > > },  
> > > "lastname": {  
> > > "type": "string"  
> > > }  
> > > }  
> > > },  
> > > "dateEdition": {  
> > > "type": "date",  
> > > "format": "dateOptionalTime"  
> > > }  
> > > }  
> > > }  
> > > }  
> > > }}
> > > 
> > > When I search ob object with the ID, it works fine but, when I try to  
> > > query the content of one of my nested objects, _ES always returns all  
> > > the objects stored in the index_. I also tried to create the objects  
> > > manually with sense and I have the same behaviour.
> > > 
> > > Example of my insert
> > > 
> > > put /tp/carte/20454795{  
> > > "dateEdition": "2014-06-01T22:00:00.000Z",  
> > > "adherents": [  
> > > {  
> > > "birthday": "1958-05-05T23:00:00.000Z",  
> > > "firstname": "ANDREW",  
> > > "lastname": "DOE"  
> > > },  
> > > {  
> > > "birthday": "1964-03-01T23:00:00.000Z",  
> > > "firstname": "ROBERT",  
> > > "lastname": "DOE"  
> > > },  
> > > {  
> > > "birthday": "1989-02-27T23:00:00.000Z",  
> > > "firstname": "DAVID",  
> > > "lastname": "DOE"  
> > > },  
> > > {  
> > > "birthday": "1990-12-11T23:00:00.000Z",  
> > > "firstname": "JOHN",  
> > > "lastname": "DOE"  
> > > }  
> > > ]  
> > > }
> > > 
> > > Finally, you could find below a query executed in sense
> > > 
> > > get /tp/carte/\_search{  
> > > "query": {  
> > > "bool": {  
> > > "must": [  
> > > {  
> > > "match": {  
> > > "adherents.lastname": {  
> > > "query": "DOE"  
> > > }  
> > > }  
> > > }  
> > > ]  
> > > }  
> > > }
> > > 
> > > How can I fix that ?
> > > 
> > > Thanks
> > > 
> > > Regards
> > > 
> > > Alexandre
> > > 
> > > --  
> > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%  
> > > [40googlegroups.com](http://40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > msgid/elasticsearch/6abc6213-b1f7-4145-9573-49401e720029%  
> > > [40googlegroups.com](http://40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/6abc6213-b1f7-4145-9573-49401e720029%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/6abc6213-b1f7-4145-9573-49401e720029%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > 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/e399b978-4d27-43f7-a294-fc2b1033e438%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e399b978-4d27-43f7-a294-fc2b1033e438%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/e399b978-4d27-43f7-a294-fc2b1033e438%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/e399b978-4d27-43f7-a294-fc2b1033e438%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/CAJQxjPO6khU8VkbOqsdHpWFeJhaoGH5nhbnyOzGjo\_d\_7Ecfyg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAJQxjPO6khU8VkbOqsdHpWFeJhaoGH5nhbnyOzGjo_d_7Ecfyg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Alexandre\_Touret](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexandre_touret/32/1473_2.png) [@Alexandre\_Touret](https://discuss.elastic.co/u/Alexandre_Touret)\
**Post date:** [June 20, 2014, 9:34am UTC](https://discuss.elastic.co/t/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index/18228/7 "2014-06-20T09:34:07Z")

</div>

That's right  
Thanks for your help 🙂

Regards

Le vendredi 20 juin 2014 11:28:26 UTC+2, Cédric Hourcade a écrit :

> It looks like you are doing a GET rather than a POST, if so your query  
> content is ignored.
> 
> Cédric Hourcade  
> [c...@wal.fr](mailto:c...@wal.fr) \<javascript:\>
> 
> On Fri, Jun 20, 2014 at 11:26 AM, Alexandre Touret \<alex...@touret.info  
> \<javascript:\>\> wrote:
> 
> > Yes  
> > My request for doe always return that answer
> > 
> > Le vendredi 20 juin 2014 11:24:33 UTC+2, David Pilato a écrit :
> > 
> > > Searching for DOE gives you that answer?  
> > > If so, it's not normal IMHO. You should try to reproduce it with a full  
> > > SENSE script recreation so we can replay it and help you from here.
> > > 
> > > See [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help/) for information.
> > > 
> > > About parent child, you could read this: [http://www](http://www).  
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://elasticsearch.org/blog/managing-relations-inside-elasticsearch/)
> > > 
> > > --  
> > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > > 
> > > Le 20 juin 2014 à 11:19:23, Alexandre Touret (alex...@touret.info) a  
> > > écrit:
> > > 
> > > Hello,  
> > > thanks for your response
> > > 
> > > When I add an other carte
> > > 
> > > put /tp/carte/20450813  
> > > {  
> > > "dateEdition": "2014-06-01T22:00:00.000Z",  
> > > "adherents": [  
> > > {  
> > > "birthday": "1963-03-22T23:00:00.000Z",  
> > > "firstname": "FLORENCE",  
> > > "lastname": "SMITH"  
> > > },  
> > > {  
> > > "birthday": "2001-10-12T22:00:00.000Z",  
> > > "firstname": "M ANGELO",  
> > > "lastname": "SMITH" },  
> > > {  
> > > "birthday": "2003-07-30T22:00:00.000Z",  
> > > "firstname": "M LILI",  
> > > "lastname": "SMITH"  
> > > }  
> > > ]  
> > > }
> > > 
> > > and I run the query described above, I have both of the two 'carte'
> > > 
> > > Is it "normal" ?  
> > > Do you have an example or a link to illustrate the parent/child feature ?
> > > 
> > > Thanks
> > > 
> > > Le vendredi 20 juin 2014 11:12:04 UTC+2, David Pilato a écrit :
> > > 
> > > > Hey Alexandre,
> > > > 
> > > > This is correct. You are searching for a carte which contains an  
> > > > adherent.  
> > > > Elasticsearch gives you a carte object as an answer. And elasticsearch  
> > > > gives you back exactly what you have indexed.
> > > > 
> > > > That being said, I think you could look at parent/child feature for  
> > > > that use case.  
> > > > Or you can have one carte object per adherent?
> > > > 
> > > > Makes sense?
> > > > 
> > > > ```
> > > > -- 
> > > > 
> > > > ```
> > > > 
> > > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > > > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > > > 
> > > > Le 20 juin 2014 à 11:06:40, Alexandre Touret (alex...@touret.info) a  
> > > > écrit:
> > > > 
> > > > hello,
> > > > 
> > > > [https://stackoverflow.com/questions/24323480/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index#](https://stackoverflow.com/questions/24323480/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index#)
> > > > 
> > > > I'm trying to index and query an index store in ES 1.2. I both create  
> > > > and populate the index with the JAVA API using the transportclient api. I  
> > > > have the following mapping:
> > > > 
> > > > get /tp/carte/\_mapping{  
> > > > "tp": {  
> > > > "mappings": {  
> > > > "carte": {  
> > > > "properties": {  
> > > > "adherents": {  
> > > > "properties": {  
> > > > "birthday": {  
> > > > "type": "date",  
> > > > "format": "dateOptionalTime"  
> > > > },  
> > > > "firstname": {  
> > > > "type": "string"  
> > > > },  
> > > > "lastname": {  
> > > > "type": "string"  
> > > > }  
> > > > }  
> > > > },  
> > > > "dateEdition": {  
> > > > "type": "date",  
> > > > "format": "dateOptionalTime"  
> > > > }  
> > > > }  
> > > > }  
> > > > }  
> > > > }}
> > > > 
> > > > When I search ob object with the ID, it works fine but, when I try to  
> > > > query the content of one of my nested objects, _ES always returns all  
> > > > the objects stored in the index_. I also tried to create the objects  
> > > > manually with sense and I have the same behaviour.
> > > > 
> > > > Example of my insert
> > > > 
> > > > put /tp/carte/20454795{  
> > > > "dateEdition": "2014-06-01T22:00:00.000Z",  
> > > > "adherents": [  
> > > > {  
> > > > "birthday": "1958-05-05T23:00:00.000Z",  
> > > > "firstname": "ANDREW",  
> > > > "lastname": "DOE"  
> > > > },  
> > > > {  
> > > > "birthday": "1964-03-01T23:00:00.000Z",  
> > > > "firstname": "ROBERT",  
> > > > "lastname": "DOE"  
> > > > },  
> > > > {  
> > > > "birthday": "1989-02-27T23:00:00.000Z",  
> > > > "firstname": "DAVID",  
> > > > "lastname": "DOE"  
> > > > },  
> > > > {  
> > > > "birthday": "1990-12-11T23:00:00.000Z",  
> > > > "firstname": "JOHN",  
> > > > "lastname": "DOE"  
> > > > }  
> > > > ]  
> > > > }
> > > > 
> > > > Finally, you could find below a query executed in sense
> > > > 
> > > > get /tp/carte/\_search{  
> > > > "query": {  
> > > > "bool": {  
> > > > "must": [  
> > > > {  
> > > > "match": {  
> > > > "adherents.lastname": {  
> > > > "query": "DOE"  
> > > > }  
> > > > }  
> > > > }  
> > > > ]  
> > > > }  
> > > > }
> > > > 
> > > > How can I fix that ?
> > > > 
> > > > Thanks
> > > > 
> > > > Regards
> > > > 
> > > > Alexandre
> > > > 
> > > > --  
> > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%  
> > > > [40googlegroups.com](http://40googlegroups.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > .  
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > 
> > > > --  
> > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > msgid/elasticsearch/6abc6213-b1f7-4145-9573-49401e720029%  
> > > > [40googlegroups.com](http://40googlegroups.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/6abc6213-b1f7-4145-9573-49401e720029%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/6abc6213-b1f7-4145-9573-49401e720029%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > .  
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/e399b978-4d27-43f7-a294-fc2b1033e438%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e399b978-4d27-43f7-a294-fc2b1033e438%40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/e399b978-4d27-43f7-a294-fc2b1033e438%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/e399b978-4d27-43f7-a294-fc2b1033e438%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/16c653f1-a932-415c-8aae-9226f2f3d7ee%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/16c653f1-a932-415c-8aae-9226f2f3d7ee%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 20, 2014, 9:34am UTC](https://discuss.elastic.co/t/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index/18228/8 "2014-06-20T09:34:50Z")

</div>

No. GET works for running searches.

It could be an issue if you are using an OLD SENSE version and not Marvel.

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 20 juin 2014 à 11:28:23, Cédric Hourcade (ced@wal.fr) a écrit:

It looks like you are doing a GET rather than a POST, if so your query content is ignored.

Cédric Hourcade  
ced@wal.fr

On Fri, Jun 20, 2014 at 11:26 AM, Alexandre Touret [alexandre@touret.info](mailto:alexandre@touret.info) wrote:  
Yes  
My request for doe always return that answer

Le vendredi 20 juin 2014 11:24:33 UTC+2, David Pilato a écrit :  
Searching for DOE gives you that answer?  
If so, it's not normal IMHO. You should try to reproduce it with a full SENSE script recreation so we can replay it and help you from here.

See [http://www.elasticsearch.org/help/](http://www.elasticsearch.org/help/) for information.

About parent child, you could read this: [http://www.elasticsearch.org/blog/managing-relations-inside-elasticsearch/](http://www.elasticsearch.org/blog/managing-relations-inside-elasticsearch/)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 20 juin 2014 à 11:19:23, Alexandre Touret (alex...@touret.info) a écrit:

Hello,  
thanks for your response

When I add an other carte

put /tp/carte/20450813  
{  
"dateEdition": "2014-06-01T22:00:00.000Z",  
"adherents": [  
{  
"birthday": "1963-03-22T23:00:00.000Z",  
"firstname": "FLORENCE",  
"lastname": "SMITH"  
},  
{  
"birthday": "2001-10-12T22:00:00.000Z",  
"firstname": "M ANGELO",  
"lastname": "SMITH" },  
{  
"birthday": "2003-07-30T22:00:00.000Z",  
"firstname": "M LILI",  
"lastname": "SMITH"  
}  
]  
}

and I run the query described above, I have both of the two 'carte'

Is it "normal" ?  
Do you have an example or a link to illustrate the parent/child feature ?

Thanks

Le vendredi 20 juin 2014 11:12:04 UTC+2, David Pilato a écrit :  
Hey Alexandre,

This is correct. You are searching for a carte which contains an adherent.  
Elasticsearch gives you a carte object as an answer. And elasticsearch gives you back exactly what you have indexed.

That being said, I think you could look at parent/child feature for that use case.  
Or you can have one carte object per adherent?

Makes sense?

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 20 juin 2014 à 11:06:40, Alexandre Touret (alex...@touret.info) a écrit:

hello,

I'm trying to index and query an index store in ES 1.2. I both create and populate the index with the JAVA API using the transportclient api. I have the following mapping:

get /tp/carte/\_mapping  
{  
"tp": {  
"mappings": {  
"carte": {  
"properties": {  
"adherents": {  
"properties": {  
"birthday": {  
"type": "date",  
"format": "dateOptionalTime"  
},  
"firstname": {  
"type": "string"  
},  
"lastname": {  
"type": "string"  
}  
}  
},  
"dateEdition": {  
"type": "date",  
"format": "dateOptionalTime"  
}  
}  
}  
}  
}  
}

When I search ob object with the ID, it works fine but, when I try to query the content of one of my nested objects, ES always returns all the objects stored in the index. I also tried to create the objects manually with sense and I have the same behaviour.

Example of my insert

put /tp/carte/20454795  
{  
"dateEdition": "2014-06-01T22:00:00.000Z",  
"adherents": [  
{  
"birthday": "1958-05-05T23:00:00.000Z",  
"firstname": "ANDREW",  
"lastname": "DOE"  
},  
{  
"birthday": "1964-03-01T23:00:00.000Z",  
"firstname": "ROBERT",  
"lastname": "DOE"  
},  
{  
"birthday": "1989-02-27T23:00:00.000Z",  
"firstname": "DAVID",  
"lastname": "DOE"  
},  
{  
"birthday": "1990-12-11T23:00:00.000Z",  
"firstname": "JOHN",  
"lastname": "DOE"  
}  
]  
}

Finally, you could find below a query executed in sense

get /tp/carte/\_search  
{  
"query": {  
"bool": {  
"must": [  
{  
"match": {  
"adherents.lastname": {  
"query": "DOE"  
}  
}  
}  
]  
}  
}

How can I fix that ?

Thanks

Regards

Alexandre

## -- 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com). To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com). For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

## 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com). To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6abc6213-b1f7-4145-9573-49401e720029%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6abc6213-b1f7-4145-9573-49401e720029%40googlegroups.com). For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

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/e399b978-4d27-43f7-a294-fc2b1033e438%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e399b978-4d27-43f7-a294-fc2b1033e438%40googlegroups.com).

For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/CAJQxjPO6khU8VkbOqsdHpWFeJhaoGH5nhbnyOzGjo\_d\_7Ecfyg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAJQxjPO6khU8VkbOqsdHpWFeJhaoGH5nhbnyOzGjo_d_7Ecfyg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/etPan.53a4003a.1befd79f.198d%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53a4003a.1befd79f.198d%40MacBook-Air-de-David.local).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Alexandre\_Touret](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexandre_touret/32/1473_2.png) [@Alexandre\_Touret](https://discuss.elastic.co/u/Alexandre_Touret)\
**Post date:** [June 20, 2014, 9:49am UTC](https://discuss.elastic.co/t/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index/18228/9 "2014-06-20T09:49:39Z")

</div>

I just upgraded to ES 1.2.1 and the latest release of mavel.  
I have the same behaviour

Le vendredi 20 juin 2014 11:34:59 UTC+2, David Pilato a écrit :

> No. GET works for running searches.
> 
> It could be an issue if you are using an OLD SENSE version and not Marvel.
> 
> --  
> _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> 
> Le 20 juin 2014 à 11:28:23, Cédric Hourcade ([c...@wal.fr](mailto:c...@wal.fr) \<javascript:\>) a  
> écrit:
> 
> It looks like you are doing a GET rather than a POST, if so your query  
> content is ignored.
> 
> Cédric Hourcade  
> [c...@wal.fr](mailto:c...@wal.fr) \<javascript:\>
> 
> On Fri, Jun 20, 2014 at 11:26 AM, Alexandre Touret \<alex...@touret.info  
> \<javascript:\>\> wrote:
> 
> > Yes  
> > My request for doe always return that answer
> > 
> > Le vendredi 20 juin 2014 11:24:33 UTC+2, David Pilato a écrit :
> > 
> > > Searching for DOE gives you that answer?  
> > > If so, it's not normal IMHO. You should try to reproduce it with a full  
> > > SENSE script recreation so we can replay it and help you from here.
> > > 
> > > See [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help/) for information.
> > > 
> > > About parent child, you could read this:  
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/blog/managing-relations-inside-elasticsearch/)
> > > 
> > > ```
> > > -- 
> > > 
> > > ```
> > > 
> > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > > 
> > > Le 20 juin 2014 à 11:19:23, Alexandre Touret (alex...@touret.info) a  
> > > écrit:
> > > 
> > > Hello,  
> > > thanks for your response
> > > 
> > > When I add an other carte
> > > 
> > > put /tp/carte/20450813  
> > > {  
> > > "dateEdition": "2014-06-01T22:00:00.000Z",  
> > > "adherents": [  
> > > {  
> > > "birthday": "1963-03-22T23:00:00.000Z",  
> > > "firstname": "FLORENCE",  
> > > "lastname": "SMITH"  
> > > },  
> > > {  
> > > "birthday": "2001-10-12T22:00:00.000Z",  
> > > "firstname": "M ANGELO",  
> > > "lastname": "SMITH" },  
> > > {  
> > > "birthday": "2003-07-30T22:00:00.000Z",  
> > > "firstname": "M LILI",  
> > > "lastname": "SMITH"  
> > > }  
> > > ]  
> > > }
> > > 
> > > and I run the query described above, I have both of the two 'carte'
> > > 
> > > Is it "normal" ?  
> > > Do you have an example or a link to illustrate the parent/child feature ?
> > > 
> > > Thanks
> > > 
> > > Le vendredi 20 juin 2014 11:12:04 UTC+2, David Pilato a écrit :
> > > 
> > > > Hey Alexandre,
> > > > 
> > > > This is correct. You are searching for a carte which contains an  
> > > > adherent.  
> > > > Elasticsearch gives you a carte object as an answer. And elasticsearch  
> > > > gives you back exactly what you have indexed.
> > > > 
> > > > That being said, I think you could look at parent/child feature for  
> > > > that use case.  
> > > > Or you can have one carte object per adherent?
> > > > 
> > > > Makes sense?
> > > > 
> > > > ```
> > > > -- 
> > > > 
> > > > ```
> > > > 
> > > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > > > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > > > 
> > > > Le 20 juin 2014 à 11:06:40, Alexandre Touret (alex...@touret.info) a  
> > > > écrit:
> > > > 
> > > > hello,
> > > > 
> > > > [https://stackoverflow.com/questions/24323480/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index#](https://stackoverflow.com/questions/24323480/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index#)
> > > > 
> > > > I'm trying to index and query an index store in ES 1.2. I both create  
> > > > and populate the index with the JAVA API using the transportclient api. I  
> > > > have the following mapping:
> > > > 
> > > > get /tp/carte/\_mapping{  
> > > > "tp": {  
> > > > "mappings": {  
> > > > "carte": {  
> > > > "properties": {  
> > > > "adherents": {  
> > > > "properties": {  
> > > > "birthday": {  
> > > > "type": "date",  
> > > > "format": "dateOptionalTime"  
> > > > },  
> > > > "firstname": {  
> > > > "type": "string"  
> > > > },  
> > > > "lastname": {  
> > > > "type": "string"  
> > > > }  
> > > > }  
> > > > },  
> > > > "dateEdition": {  
> > > > "type": "date",  
> > > > "format": "dateOptionalTime"  
> > > > }  
> > > > }  
> > > > }  
> > > > }  
> > > > }}
> > > > 
> > > > When I search ob object with the ID, it works fine but, when I try to  
> > > > query the content of one of my nested objects, _ES always returns all  
> > > > the objects stored in the index_. I also tried to create the objects  
> > > > manually with sense and I have the same behaviour.
> > > > 
> > > > Example of my insert
> > > > 
> > > > put /tp/carte/20454795{  
> > > > "dateEdition": "2014-06-01T22:00:00.000Z",  
> > > > "adherents": [  
> > > > {  
> > > > "birthday": "1958-05-05T23:00:00.000Z",  
> > > > "firstname": "ANDREW",  
> > > > "lastname": "DOE"  
> > > > },  
> > > > {  
> > > > "birthday": "1964-03-01T23:00:00.000Z",  
> > > > "firstname": "ROBERT",  
> > > > "lastname": "DOE"  
> > > > },  
> > > > {  
> > > > "birthday": "1989-02-27T23:00:00.000Z",  
> > > > "firstname": "DAVID",  
> > > > "lastname": "DOE"  
> > > > },  
> > > > {  
> > > > "birthday": "1990-12-11T23:00:00.000Z",  
> > > > "firstname": "JOHN",  
> > > > "lastname": "DOE"  
> > > > }  
> > > > ]  
> > > > }
> > > > 
> > > > Finally, you could find below a query executed in sense
> > > > 
> > > > get /tp/carte/\_search{  
> > > > "query": {  
> > > > "bool": {  
> > > > "must": [  
> > > > {  
> > > > "match": {  
> > > > "adherents.lastname": {  
> > > > "query": "DOE"  
> > > > }  
> > > > }  
> > > > }  
> > > > ]  
> > > > }  
> > > > }
> > > > 
> > > > How can I fix that ?
> > > > 
> > > > Thanks
> > > > 
> > > > Regards
> > > > 
> > > > Alexandre
> > > > 
> > > > --  
> > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > .  
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > 
> > > > --  
> > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/6abc6213-b1f7-4145-9573-49401e720029%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6abc6213-b1f7-4145-9573-49401e720029%40googlegroups.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/6abc6213-b1f7-4145-9573-49401e720029%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/6abc6213-b1f7-4145-9573-49401e720029%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > .  
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/e399b978-4d27-43f7-a294-fc2b1033e438%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e399b978-4d27-43f7-a294-fc2b1033e438%40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/e399b978-4d27-43f7-a294-fc2b1033e438%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/e399b978-4d27-43f7-a294-fc2b1033e438%40googlegroups.com?utm_medium=email&utm_source=footer).
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAJQxjPO6khU8VkbOqsdHpWFeJhaoGH5nhbnyOzGjo\_d\_7Ecfyg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAJQxjPO6khU8VkbOqsdHpWFeJhaoGH5nhbnyOzGjo_d_7Ecfyg%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAJQxjPO6khU8VkbOqsdHpWFeJhaoGH5nhbnyOzGjo\_d\_7Ecfyg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAJQxjPO6khU8VkbOqsdHpWFeJhaoGH5nhbnyOzGjo_d_7Ecfyg%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/4cd45b68-32ca-4427-8523-d898c75fc44b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4cd45b68-32ca-4427-8523-d898c75fc44b%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Cedric\_Hourcade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cedric_hourcade/32/1451_2.png) [@Cedric\_Hourcade](https://discuss.elastic.co/u/Cedric_Hourcade)\
**Post date:** [June 20, 2014, 10:04am UTC](https://discuss.elastic.co/t/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index/18228/10 "2014-06-20T10:04:45Z")

</div>

Ah yes sorry you are right, I am using some old tools 🙂

Cédric Hourcade  
[ced@wal.fr](mailto:ced@wal.fr)

On Fri, Jun 20, 2014 at 11:49 AM, Alexandre Touret [alexandre@touret.info](mailto:alexandre@touret.info)  
wrote:

> I just upgraded to ES 1.2.1 and the latest release of mavel.  
> I have the same behaviour
> 
> Le vendredi 20 juin 2014 11:34:59 UTC+2, David Pilato a écrit :
> 
> > No. GET works for running searches.
> > 
> > It could be an issue if you are using an OLD SENSE version and not Marvel.
> > 
> > --  
> > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > 
> > Le 20 juin 2014 à 11:28:23, Cédric Hourcade ([c...@wal.fr](mailto:c...@wal.fr)) a écrit:
> > 
> > It looks like you are doing a GET rather than a POST, if so your query  
> > content is ignored.
> > 
> > Cédric Hourcade  
> > [c...@wal.fr](mailto:c...@wal.fr)
> > 
> > On Fri, Jun 20, 2014 at 11:26 AM, Alexandre Touret [alex...@touret.info](mailto:alex...@touret.info)  
> > wrote:
> > 
> > > Yes  
> > > My request for doe always return that answer
> > > 
> > > Le vendredi 20 juin 2014 11:24:33 UTC+2, David Pilato a écrit :
> > > 
> > > > Searching for DOE gives you that answer?  
> > > > If so, it's not normal IMHO. You should try to reproduce it with a  
> > > > full SENSE script recreation so we can replay it and help you from here.
> > > > 
> > > > See [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help/) for information.
> > > > 
> > > > About parent child, you could read this: [http://www](http://www).  
> > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://elasticsearch.org/blog/managing-relations-inside-elasticsearch/)
> > > > 
> > > > ```
> > > > --
> > > > 
> > > > ```
> > > > 
> > > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > > > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > > > 
> > > > Le 20 juin 2014 à 11:19:23, Alexandre Touret (alex...@touret.info) a  
> > > > écrit:
> > > > 
> > > > Hello,  
> > > > thanks for your response
> > > > 
> > > > When I add an other carte
> > > > 
> > > > put /tp/carte/20450813  
> > > > {  
> > > > "dateEdition": "2014-06-01T22:00:00.000Z",  
> > > > "adherents": [  
> > > > {  
> > > > "birthday": "1963-03-22T23:00:00.000Z",  
> > > > "firstname": "FLORENCE",  
> > > > "lastname": "SMITH"  
> > > > },  
> > > > {  
> > > > "birthday": "2001-10-12T22:00:00.000Z",  
> > > > "firstname": "M ANGELO",  
> > > > "lastname": "SMITH" },  
> > > > {  
> > > > "birthday": "2003-07-30T22:00:00.000Z",  
> > > > "firstname": "M LILI",  
> > > > "lastname": "SMITH"  
> > > > }  
> > > > ]  
> > > > }
> > > > 
> > > > and I run the query described above, I have both of the two 'carte'
> > > > 
> > > > Is it "normal" ?  
> > > > Do you have an example or a link to illustrate the parent/child feature  
> > > > ?
> > > > 
> > > > Thanks
> > > > 
> > > > Le vendredi 20 juin 2014 11:12:04 UTC+2, David Pilato a écrit :
> > > > 
> > > > > Hey Alexandre,
> > > > > 
> > > > > This is correct. You are searching for a carte which contains an  
> > > > > adherent.  
> > > > > Elasticsearch gives you a carte object as an answer. And  
> > > > > elasticsearch gives you back exactly what you have indexed.
> > > > > 
> > > > > That being said, I think you could look at parent/child feature for  
> > > > > that use case.  
> > > > > Or you can have one carte object per adherent?
> > > > > 
> > > > > Makes sense?
> > > > > 
> > > > > ```
> > > > > --
> > > > > 
> > > > > ```
> > > > > 
> > > > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > > > > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > > > > 
> > > > > Le 20 juin 2014 à 11:06:40, Alexandre Touret (alex...@touret.info) a  
> > > > > écrit:
> > > > > 
> > > > > hello,
> > > > > 
> > > > > [https://stackoverflow.com/questions/24323480/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index#](https://stackoverflow.com/questions/24323480/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index#)
> > > > > 
> > > > > I'm trying to index and query an index store in ES 1.2. I both create  
> > > > > and populate the index with the JAVA API using the transportclient api. I  
> > > > > have the following mapping:
> > > > > 
> > > > > get /tp/carte/\_mapping{  
> > > > > "tp": {  
> > > > > "mappings": {  
> > > > > "carte": {  
> > > > > "properties": {  
> > > > > "adherents": {  
> > > > > "properties": {  
> > > > > "birthday": {  
> > > > > "type": "date",  
> > > > > "format": "dateOptionalTime"  
> > > > > },  
> > > > > "firstname": {  
> > > > > "type": "string"  
> > > > > },  
> > > > > "lastname": {  
> > > > > "type": "string"  
> > > > > }  
> > > > > }  
> > > > > },  
> > > > > "dateEdition": {  
> > > > > "type": "date",  
> > > > > "format": "dateOptionalTime"  
> > > > > }  
> > > > > }  
> > > > > }  
> > > > > }  
> > > > > }}
> > > > > 
> > > > > When I search ob object with the ID, it works fine but, when I try  
> > > > > to query the content of one of my nested objects, _ES always returns  
> > > > > all the objects stored in the index_. I also tried to create the  
> > > > > objects manually with sense and I have the same behaviour.
> > > > > 
> > > > > Example of my insert
> > > > > 
> > > > > put /tp/carte/20454795{  
> > > > > "dateEdition": "2014-06-01T22:00:00.000Z",  
> > > > > "adherents": [  
> > > > > {  
> > > > > "birthday": "1958-05-05T23:00:00.000Z",  
> > > > > "firstname": "ANDREW",  
> > > > > "lastname": "DOE"  
> > > > > },  
> > > > > {  
> > > > > "birthday": "1964-03-01T23:00:00.000Z",  
> > > > > "firstname": "ROBERT",  
> > > > > "lastname": "DOE"  
> > > > > },  
> > > > > {  
> > > > > "birthday": "1989-02-27T23:00:00.000Z",  
> > > > > "firstname": "DAVID",  
> > > > > "lastname": "DOE"  
> > > > > },  
> > > > > {  
> > > > > "birthday": "1990-12-11T23:00:00.000Z",  
> > > > > "firstname": "JOHN",  
> > > > > "lastname": "DOE"  
> > > > > }  
> > > > > ]  
> > > > > }
> > > > > 
> > > > > Finally, you could find below a query executed in sense
> > > > > 
> > > > > get /tp/carte/\_search{  
> > > > > "query": {  
> > > > > "bool": {  
> > > > > "must": [  
> > > > > {  
> > > > > "match": {  
> > > > > "adherents.lastname": {  
> > > > > "query": "DOE"  
> > > > > }  
> > > > > }  
> > > > > }  
> > > > > ]  
> > > > > }  
> > > > > }
> > > > > 
> > > > > How can I fix that ?
> > > > > 
> > > > > Thanks
> > > > > 
> > > > > Regards
> > > > > 
> > > > > Alexandre
> > > > > 
> > > > > --  
> > > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > > msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%  
> > > > > [40googlegroups.com](http://40googlegroups.com)  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > .  
> > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > 
> > > > > --  
> > > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > > msgid/elasticsearch/6abc6213-b1f7-4145-9573-49401e720029%  
> > > > > [40googlegroups.com](http://40googlegroups.com)  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/6abc6213-b1f7-4145-9573-49401e720029%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/6abc6213-b1f7-4145-9573-49401e720029%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > .  
> > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > 
> > > > --  
> > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > msgid/elasticsearch/e399b978-4d27-43f7-a294-fc2b1033e438%  
> > > > [40googlegroups.com](http://40googlegroups.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/e399b978-4d27-43f7-a294-fc2b1033e438%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/e399b978-4d27-43f7-a294-fc2b1033e438%40googlegroups.com?utm_medium=email&utm_source=footer).
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > msgid/elasticsearch/CAJQxjPO6khU8VkbOqsdHpWFeJhaoG  
> > H5nhbnyOzGjo\_d\_7Ecfyg%[40mail.gmail.com](http://40mail.gmail.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/CAJQxjPO6khU8VkbOqsdHpWFeJhaoGH5nhbnyOzGjo\_d\_7Ecfyg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAJQxjPO6khU8VkbOqsdHpWFeJhaoGH5nhbnyOzGjo_d_7Ecfyg%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > 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/4cd45b68-32ca-4427-8523-d898c75fc44b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4cd45b68-32ca-4427-8523-d898c75fc44b%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/4cd45b68-32ca-4427-8523-d898c75fc44b%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/4cd45b68-32ca-4427-8523-d898c75fc44b%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/CAJQxjPOg\_und7KTvuJzecJwSGxmxx7HPzkRewPNoEyDzFpRAqQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAJQxjPOg_und7KTvuJzecJwSGxmxx7HPzkRewPNoEyDzFpRAqQ%40mail.gmail.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, 1:20am UTC](https://discuss.elastic.co/t/elasticsearch-queries-always-return-all-the-datas-stored-in-the-index/18228/11 "2017-07-06T01:20:57Z")

</div>


