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 | @elasticsearchfr Le 20 juin 2014 à 11:06:40, Alexandre Touret ([email protected]) 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/6102e860-e997-45db-9db4-7da309e6c761%40googlegroups.com. 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/etPan.53a3fad7.5bd062c2.198d%40MacBook-Air-de-David.local. For more options, visit https://groups.google.com/d/optout.
