Regex over _uid field

(Borja Berástegui) #1

Hi all !

I was using a previous version of ES in order to apply regexp on an _uid field by using the following query (_trying to get id fields greater than 26 characters):

{ "query": { "bool": { "must": [ { "regexp": { "_uid": { "value": "mydoctype..{26,}" } } } ] } } }

And this was working as expected.

Unfortunately, after upgrading to the latest version of ES, I got the following error when running the same search:

TransportError(400, u'search_phase_execution_exception', u'Can only use regexp queries on keyword and text fields - not on [_uid] which is of type [_uid]')

Is the regexp support over meta fields no longer supported?

Is there any other way of doing this that I might be missing?

Thanks in advance for your time !

Edit: For helping and clarification for the next person that lands here, the answer was given here:

And the summary is that no, regexp on _uid is not supported anymore, and the reason is:

We plan on switching _uid to a more compact (binary) representation in the future, which will make the uid field incompatible with regexp, prefix or wildcard queries. So I don't think we should allow this again.


(Nik Everett) #2

It may have worked but I don't think it worked "as expected". The script.engine.groovy.inline.update setting doesn't have anything to do with the regexp query. Unless you really need to turn on inline groovy scripting I'd turn it off because it is a security nightmare.

I think your issue is that _uid changed to not allow those kinds of queries. I opened an issue to discuss it:

I don't know that we'll want to support those queries for _uid, but that'll be settled in the issue. You should be able to work around the issue using a script query and the doc values storage for _uid but it'll be much slower because it won't be able to use the index.

(Borja Berástegui) #3

Hi !

I messed up the question by adding the groovy thing, totally true that it was not related to that at all, I already edited the question for the sake of clarity :slight_smile:

I'll follow up that discussion then, as I see it's no longer possible to do what I was doing before !

Thanks for your reply !

(system) #4

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