I have been using query_string to filter out the results. Now the problem is, when I try to use query string as "I LOVE MY JOB AND MY BOSS" elastic search treats AND as operator and my results are going wrong.
But, in this case AND is not an operator.
How to tell AND is not an operator and its a string to elasticsearch. Any solution to this problem would be a great help.
Thanks in advance.
EDIT-1 (QUERY_STRING)
{
"_source": ["customer.ezPayId", "customer.billingContact.name", "customer.serviceContact.name", "customer.wmMetaData.library"],
"query": {
"bool": {
"must_not": [{
"term": {
"customer.lob": {
"value": "residential"
}
}
}],
"should": [{
"query_string": {
"query": "ROCHESTER GAS AND ELECTRIC"
}
},
{
"regexp": {
"customer.serviceContact.name_ivr": "ROCHESTER GAS AND ELECTRIC<0-999>"
}
}, {
"regexp": {
"customer.billingContact.name_ivr": "ROCHESTER GAS AND ELECTRIC<0-999>"
}
}, {
"regexp": {
"customer.serviceContact.name_ivr": ".<0-999>ROCHESTER GAS AND ELECTRIC"
}
}, {
"regexp": {
"customer.billingContact.name_ivr": ".<0-999>ROCHESTER GAS AND ELECTRIC"
}
}, {
"regexp": {
"customer.serviceContact.name_ivr": "ROCHESTER GAS AND ELECTRIC[0-9-',(/)@%#&*$!^+_|]"
}
}, {
"regexp": {
"customer.billingContact.name_ivr": "ROCHESTER GAS AND ELECTRIC[0-9-',(/)@%#&*$!^+_|]"
}
}]
}
},
"filter": {
"or": [{
{
"term": {
"customer.billingContact.name_ivr": "ROCHESTER GAS AND ELECTRIC"
}
}, {
"term": {
"customer.serviceContact.name_ivr": "ROCHESTER GAS AND ELECTRIC"
}
}, {
"regexp": {
"customer.serviceContact.name_ivr": "ROCHESTER GAS AND ELECTRIC<0-999>"
}
}, {
"regexp": {
"customer.billingContact.name_ivr": "ROCHESTER GAS AND ELECTRIC<0-999>"
}
}, {
"regexp": {
"customer.serviceContact.name_ivr": ".<0-999>ROCHESTER GAS AND ELECTRIC"
}
}, {
"regexp": {
"customer.billingContact.name_ivr": ".<0-999>ROCHESTER GAS AND ELECTRIC"
}
}, {
"regexp": {
"customer.serviceContact.name_ivr": "[0-9-',(/)@%#&*$!^+_| ].+ROCHESTER GAS AND ELECTRIC"
}
}, {
"regexp": {
"customer.billingContact.name_ivr": "[0-9-',(/)@%#&*$!^+_| ].+ROCHESTER GAS AND ELECTRIC"
}
}, {
"regexp": {
"customer.serviceContact.name_ivr": "ROCHESTER GAS AND ELECTRIC[0-9-',(/)@%#&*$!^+_| ].+"
}
}, {
"regexp": {
"customer.billingContact.name_ivr": "ROCHESTER GAS AND ELECTRIC[0-9-',(/)@%#&*$!^+_| ].+"
}
}, {
"regexp": {
"customer.serviceContact.name_ivr": "(.*) ROCHESTER GAS AND ELECTRIC (.*)"
}
}, {
"regexp": {
"customer.billingContact.name_ivr": "(.*) ROCHESTER GAS AND ELECTRIC (.*)"
}
}]
}
}