Hi @Christian_Dahlqvist.
you are getting correct please same as you understood above :
we are looking for all in one search fields but some times user can provide some fields not complete fields but result should be come based on exact match as passing the fields values.
one size fits all query template
Sample data:
{"_index":"dbdataindex_join_allcolumns_qa_modify_cm_28_08_2019","_type":"caremanager","_id":"W5_X3GwBthBZI3l8q","_score":1.0,"_source":{"dob":"1956-77-27T18:30:00.000Z","patientname":"Aba","city":null,"provider_type":"P","medicare":"167A","care_program_name":"C Management","@timestamp":"2019-08-29T10:00:47.614Z","dob1":"06/28/1996","log_date":"2019-77-25T18:30:00.000Z","email":null,"regionname":"M05","phone_home":"79999921","age":63,"pcp":"Lastn861 First904","active":"A","sex":"M","user_id":898888,"caremanager":"HElth","pid":249,"@version":"1","patient_provider_hrk":28888889,"careprog_id":20,"beneficiary_status":"Active"}},{"_index":"dbdataindex_join_allcolumns_qa_modify_cm_28_08_2019","_type":"caremanager","_id":"hZ_X3GwBthBZI3l8q","_score":1.0,"_source":{"dob":"1968-99-05T00:00:00.000Z","patientname":"Atu","city":null,"provider_type":"P","medicare":"1993A","care_program_name":"Di Care","@timestamp":"2019-88-29T10:00:47.636Z","dob1":"12/05/1968","log_date":null,"email":null,"regionname":"M00S","phone_home":"","age":50,"pcp":"Lastn3 Firs52","active":"A","sex":"F","user_id":29997,"caremanager":"LIANE","pid":0092,"@version":"1","patient_provider_hrk":99990,"careprog_id":1,"beneficiary_status":"Active"}},
sample query :
<{ "size" : 1000, "query" : { "bool" : { "must" : [ { "bool" : { "must" : [ { "term" : { "regionname.keyword" : { "value" : "MS5S", "boost" : 1.0 } } }, { "term" : { "caremanager.keyword" : { "value" : "HECM", "boost" : 1.0 } } } ], "adjust_pure_negative" : true, "boost" : 1.0 } }, { "term" : { "patientname.keyword" : { "value" : "Aaa", "boost" : 1.0 } } } ], "adjust_pure_negative" : true, "boost" : 1.0 } }, "_source" : { "includes" : [ "@version", "active", "beneficiary_status", "care_program_name", "caremanager", "city", "dob1", "email", "medicare", "patientname", "pcp", "phone_home", "provider_type", "regionname", "sex" ], "excludes" : [ ] }, "docvalue_fields" : [ { "field" : "@timestamp", "format" : "epoch_millis" }, { "field" : "age" }, { "field" : "careprog_id" }, { "field" : "dob", "format" : "epoch_millis" }, { "field" : "log_date", "format" : "epoch_millis" }, { "field" : "patient_provider_hrk" }, { "field" : "pid" }, { "field" : "user_id" } ], "sort" : [ { "_doc" : { "order" : "asc" } } ] } />
above query fail if we will not pass the value for any fields and we want all fields in query for search patient records.
Thanks Very much for helping @Christian_Dahlqvist