Monday, 15 August 2011

java - ElasticSearch queries always return all the datas stored in the index -



java - ElasticSearch queries always return all the datas stored in the index -

i'm trying index , query index store in es 1.2. both create , populate index java api using transportclient api. have next 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 search ob object id, works fine but, when seek query content of 1 of nested objects, es returns objects stored in index. tried create objects manually sense , have same behaviour.

example of insert

post /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, find below query executed in sense

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

how can prepare ?

thanks

regards

the search queries executed request. content ignored. post query's homecoming good

java elasticsearch

No comments:

Post a Comment