Search in specific document in Bleve?

87 views
Skip to first unread message

Wolfe

unread,
Aug 14, 2023, 5:30:56 AM8/14/23
to bleve
Hey there!

Is it possible to search in a specific document mapping in Bleve? I see no options to do that with Search Request! 

Abhi Dangeti

unread,
Aug 14, 2023, 12:52:43 PM8/14/23
to bleve
Setting a field is the only way for the search request to obtain pertinent data - and unfortunately this field needs to be a leaf of the mapping hierarchy.
If you do not set the field, the query will be directly to a composite field - `_all` where a copy of the indexed content will be held if specified in your mapping.

There is one way I can think of to do what you need -
- Let's say this is your document structure ..
```
{
    "name": ...,
    "xyz": ...,
    "address": {
        "country": ...,
        "city": ...,
        "county": ...,
        "state": ...,
    },
    ...
}
```
- You can explicitly index address.country, address.city, address.county, address.state and also include them all to the composite field `_all`. Like I mentioned earlier - this composite field is where your query will be directed to if you don't specify the field in the request.
- To achieve what you're intending for - you'll want to to do this maneuver for ONLY fields that fall within that document mapping.
Reply all
Reply to author
Forward
0 new messages