I need some suggestion on how to search for any alphanumeric range search if its possible in elasticsearch.
I have gone through the below link , I am not able to find any solution for alphanumeric search.
Example . I have a field called "page_number" which stores D1-D4. if user search for page number something like D3 , is there any possible way to search in elasticsearch in between pages?
Please help me suggest a solution.
You would not be able to use the
range datatype for that. Instead, you could separately index the bottom and upper end of the range, and then query those values using a bool query.
For example, given this document:
You can query like this:
Thanks a lot
@abdon I shall try your solution
I have tried the method that you have mentioned above but its ain't working.
I have made pageno and endpageno as the image below as keyword field. but its not working
Please help in giving some suggestion to it.
pageno.keyword instead of
endpageno.keyword instead of
This has to do with that fact that your query is not analyzed, but the text fields
Thanks for your reply . But for me, pageno and endpageno is already a keyword field so it will not be analyzed.
Please see the below screenshot:
Oh, I see. You switched the
gte. Try this:
Was the recommendation to use a filter clause not a should clause?
If you use a should clause you need to set the
Thanks a lot
@abdon its working fine
Good to hear! But Ignacio had a good point too: those range queries should be in a
filter clause instead of a
@abdona and @Ignacio_Vera,
Thanks for helping me out in this, I have used as a part of filter to search for the page number range and its working for both alphanumeric and integer data.
Thanks a lot both for your help
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.