-
Notifications
You must be signed in to change notification settings - Fork 77
How to search documents with id prefix? #137
Comments
Hi @lauthrul ,
Add the following field definitions to your schema:
You could search for the following query:
|
Thanks for reply. Because the document is unchangable, so I can't add id filed to the document. I found a way to search with id prefix, just add "+_id:path/A/*" to the query. But now there is another question. How to implement logic operatation(and, or) in the query conditon? For example, I want to search A kind documents which contains "xxx" in name or some other fileds(let's say short_name). this is like:
This will search all documents of A kind, condition "name:xxx short_name:xxx" didn't take effect. If change to "+name:xxx +short_name:xxx", nothing searched. As bleve offical documents says, "+" means MUST, so this is mean name or short_name is a MUST or MUST NOT meet condition. However, what I want is OR and AND condition, that is, I want xxx in name OR short_name, AND with id prefix "path/A/". Do you have any ideas of how to implement this? |
@lauthrul |
I have two kind of documents, A and B, I index them in bulk with different document id prefix. basically like:
Now I only want to search documents with id prefix "path/A/". How to do this?
The text was updated successfully, but these errors were encountered: