Index Join possible?

I’ve a requirement to search on multiple index (Inventory and Product) at the same time and combine result.
Is there a way to search on multiple index and combine result in the same way as join (Left / Inner)?

More background of my project.
“Product” index will have 10 Million plus records
and “Inventory” index will have about 5-6 Million records.

“Product” index will be updated a few time per day.
“Inventory” index will be updated a lot more often.

Is it a good idea to combine “Product” and “Inventory” into one index and use distinct?

Hi @pongsakorn.pluemkoso,

Thanks for contacting Algolia!

It is possible to do a single query on multiple indexes (for example, see this JSFiddle ). However, as you may already know Algolia is not a relational database. If you did do the multi-index query, it would be up to you to combine the results on the front-end, but doing so would lose the relevance/ranking.

If you do have a known relationship between your Product and Inventory indices you have to transform your records into “flat” objects - each object also includes their linked dependencies. For example:

{ //sample Product record
    "objectID": 1
    "name": "myProduct"
    "inventory_ids": [2]
}

{ //sample Inventory record
    "objectID": 2
    "name": "myInventory"
    "product_ids": [1]
}

Generally, we recommend separating different object types into different indices.

If you provide more detail on your record structure, the example query you would enter, and the example results you would want to see, perhaps we can better guide you!

Let us know how it goes!

We are looking for an answer for this approach too. We have about the same idea of a structure as your example.

But how is it possible to show results based on that the “product” object has a “inventory” object with filters on?

We will have a object which includes localization filters, eg locality availability and not only being in stock.

Eg: we’d like to find products that’s available in Sweden.

My idea is to have one object that represents a inventory, and that inventory will include a list of which countries it’s available in.

Is this doable? In that case how could this query maybe look like?

Thanks!

Thanks for the idea man