javascript - elasticsearch search filter equals issue -
i have index of person database below mapping.
{ "person" : { "sex" : { "type" : "string" }, "dob" : { "type" : "string" }, "fname" : { "type" : "string" }, "lname" : { "type" : "string" }, "phone" : { "type" : "string" } } }
my need find matching entries multiple conditional clauses.
dob + phone + sex (or) fname + lname + dob
how create query or filter (using bool) above condition. need query or filter case-insensitive.
any ideas?
thanks
nesting 2 sets of must queries inside should query meet requirements, see bool more information:
curl -xget 'http://localhost:9200/people/person/_search?pretty' -d '{ "query": { "bool": { "should": [ {"bool": { "must": [ {"match": { "sex" : "male" }}, {"match": { "dob" : "2000-11-14" }}, {"match": { "phone" : "1234 67889" }} ] } }, {"bool": { "must": [ {"match": { "fname" : "bob" }}, {"match": { "dob" : "2000-11-14" }}, {"match": { "lname" : "smith" }} ] } } ] } } }'
also need query or filter case-insensitive.
the standard analyzer index data in lowercase - match query apply same analyzer search term.
also - idea store dob date.
Comments
Post a Comment