We have created an index with analyzer which uses "keyword" as tokenizer. We have values such in a field as role_number which may or may not contain any special character such as - or _, for examplecontains data as COM-DEV-12345666 or ORG-PROD-43211 or 4321. We are trying to enable search by substring using query string. We have few observation for which we are trying to find the right reason.
For example when we do exact search as
q=role_number:ORG\-PROD\-43211 This returns the exact field (expected results)
q=role_number:*43211* This returns the all fields which contains 43211
However below are unexpected results
q=role_number:*-PROD\-43211* does not return any data (whenever we combine alphabet in the search string it doesnt return any data)
q=role_number:*ORG/A/PROD/A/43211* This query returns all the data which has 43211 in any fields. ( ideally it should return only those data which has similar regex data in the role_number not rest of the fields.
We are currently using Elasticsearch of version 1.4.2 and lucene version of 4.10.2. Can someone please refer the right Elasticsearch documentation which could explain this behavior. Also please guide us the right way to query by sub string in Elasticsearch. Thanks in advance.