Numeric filter in string field- painless?

I was wondering whether this is possible somehow:

I want to write a query on text where I can do the equivalent of:

"fetch documents mentioning a number >2 within X words of 'bicycle"

That's a string field, but I need to apply a range filter on a numeric value in it. I was wondering whether there was a way to filter using a regex , say, of numeric characters, and then convert those tokens to an integer and filter using painless.

I'm not experienced enough in painless and was wondering whether this idea has legs. Or whether in fact this type of thing isn't easily doable.

Many thanks

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.