Is it possible to do a wildcard search in a long or a numeric field in elasticsearch ?
wildcard query works on terms only. Can you explain your use-case? Wouldnt ranges work better, or if not, maybe another index time data structure?
The problem is, if the long field has value 120450, 120445, 120656. Please find the query below.
The response should return all the three documents which has partial match for 120. Is it possible to achieve this in long or a numeric field ?
you could index the number as a string field as well and then use the wildcard query (which you did not use in your example, slightly confused).
Alex, I should not change the mapping of the index. Can you please let me know is it possible to achieve using numeric fields ?
no it is not. You could index a field as string and number if you need - I do not see why this is a problem. Check out the Elasticsearch documentation about the fields parameter in mappings.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.