ttp://10.10.64.182:9200/decision_opt_test/_search
getQueryObj = (page, searchKey)=>{
let queryObj = {
"sort": [
{"time": {"order": "desc"}},
"_score"
],
"query": {
"bool": {
"should": [{
"bool": {
"must": []
}
},
{
"bool": {
"must_not": {
"match": {
"content": "WX,KN,BZZ,LENDCAR,RMYSX,QZ,RM,YGX,GD"
}
},
"must": []
}
}
]
}
},
"size": this.state.size,
"from": this.state.size * page
};
if(searchKey){
if(this.state.field == 'code' ){
queryObj.query.bool.should[0].bool.must[0] = { "match": { "code": this.state.searchKey }};
queryObj.query.bool.should[0].bool.must[1] = { "match": { "content": this.state.channelsKeyArr }};
queryObj.query.bool.should[1].bool.must[0] = { "match": { "code": this.state.searchKey }};
}else if(this.state.field == 'operationName'){
queryObj.query.bool.should[0].bool.must[0] = { "wildcard": { "operationName": "*"+this.state.searchKey+"*" }};
queryObj.query.bool.should[0].bool.must[1] = { "match": { "content": this.state.channelsKeyArr }};
queryObj.query.bool.should[1].bool.must[0] = { "wildcard": { "operationName": "*"+this.state.searchKey+"*" }};
}else{
queryObj.query.bool.should[0].bool.must[0] = { "wildcard": { "operationType": "*"+this.state.searchKey+"*" }};
queryObj.query.bool.should[0].bool.must[1] = { "match": { "content": this.state.channelsKeyArr }};
queryObj.query.bool.should[1].bool.must[0] = { "wildcard": { "operationType": "*"+this.state.searchKey+"*" }};
}
}
return queryObj;
};