How to efficiently search a list of data structures with filtering support

I’m working on a project where I need to create search functionality that can efficiently search a list of data structures like:

json1 = (
  {
    "name": "bob",
    "age": 55,
    "active": false,
    "location": {
      "state": "FF",
      "country": "NZ"
    }
  {,
  {
    "name": "susan",
    "age": 30,
    "active": true,
    "location": {
      "state": "BB",
      "country": "USA"
    }
  {
)
json2 = (...)

The user would in put something like categories: (json1, json2), fields: (name, location), search_term: "bob"

It needs to support complex queries. I’ve looked at inverted indexing used in search engines but all the implementations I see are for text searching, not searching data structures and they don’t appear to be suitable for filtering based on a data structure field etc. I have the following requirements:

  • Needs to be able to search based on a field (ie name/age/active)
  • It very likely will need to support searching like search value > 40 IN json1 FIELD age
  • Needs to support nested structures like location

Are there any data structures more suitable than an inverted index? If inverted indexing is the way to go can you please provide guidance on how the structure should look in order to support my requirements? Any general reading suggestions on the matter would also be great.