I am using Java API to query elastic search index. I have indexed data having complex structure through Couchbase into ElasticSearch. My data is as follows :
e.g.
{
"detail": {
"lastName": "JOSEPH",
"firstName": "JOHN",
"birthDate": "19621022",
"gender": "M"
},
"vehicles": {
"vehicle": [
{
"state": "CA",
"model": "RAPIDE",
"color1": "BGE",
"color2": "BLK",
"licensePlate": "cdgh34676",
"make": "ASTONMARTIN"
},
{
"state": "LA",
"model": "AUDI",
"color1": "BGE",
"color2": "BLK",
"licensePlate": "abcd1209",
"make": "ASTONMARTIN"
}
]
}
}
My Questions are:
- I am querying using:
client.prepareSearch("index_name").setTypes("couchbaseDocument").setQuery(QueryBuilders.fieldQuery("detail.lastName", "JOSEPH"))).execute().actionGet();
It returns 0 hits but if i set QueryBuilders.fieldQuery("lastName", "JOSEPH") it returns the result with hit count 1 ?
-
Can i define Facet on say gender present in detail using .addFacet() and adding field as detail.lastName. In my case this is also not working.
-
How can i define facet on fields color1, color2 present in vehicles.vehicle
Thanks,
Chavan15