Hi @dadoonet.
Thanks
i am trying to search the records based on below sql query condition
condition :- 01
i have 8-fields in current index use case and i want to search all fields value based on provided value with fields like-
field1:'data'
field2:'sata'
field5:2424
field8:PHM
Condition02:-
in above search field i am not providing field value for field3,4,6,7
but we need this field for next search in current query and want exact matching result with previous -
field1:'data'
field2:'sata'
field5:2424
field8:'PHM'
Condition3:-1:
when i used --and-- (MATCH IN ES)condition for
field1:'data'
field2:'sata'
field5:2424
field8:PHM
--then it fetch exact matching records but if we are not passing the value for any field this query is going to fail.
--if i used --OR--(should in ES) condition then it fetching all matching records with all fields that is wrong in my use case.
{
"query": "select * from dbdataindex_join_allcolumns_qa_modify_cm_28_08_2019 where regionname='MSP 05S' and caremanager='HM CM' and patientname='Aaron' "
}
SAME QUERY in DSL:-
<{ "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" } } ] } />
Final Request :-
i want --all field-- in search search query but user can provide some time 3,4,5 fields only but result should come based on provided fields values.
Very thanks .
HadoopHelp