Retrieve all ids that starts with a string


#1

Hello!

We want to retrieve all documents that have a common part in their ids.
For example we want to retrieve all ids that starts with B*.

I saw the ids query, but it is not we want and also using a regexp on _id or uid fields doesn't work ("Can only use regexp queries on keyword and text fields - not on [_uid] which is of type [_uid]").

It is possible to search something like this?

Thank you,


(Alexander Reelsen) #2

Hey,

you might want to check out the prefix query. Also note, that _uid also contains the type, so maybe just add that id field in your JSON body and then go from there.

---Alex


#3

Hello,

Thank you for your quick response, but prefix query doesn't work also ("Can only use prefix queries on keyword and text fields - not on [_id] which is of type [_id]", similar for _uid).

Btw, we use ES 5.0.0.


(Alexander Reelsen) #4

Hey,

that's why I said, you should add the id as a regular field to your JSON document, sorry if that wasnt clear.

--Alex


(system) #5

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