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*
> @dadoonet <https://twitter.com/dadoonet> | @elasticsearchfr
> <https://twitter.com/elasticsearchfr>
>
>
> Le 20 juin 2014 à 11:06:40, Alexandre Touret ([email protected]
> <javascript:>) a écrit:
>
> hello,
>
>
>
> <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 [email protected] <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?utm_medium=email&utm_source=footer>
> .
> For more options, visit 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/6abc6213-b1f7-4145-9573-49401e720029%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.