Routing based on array field


(Volodymyr Usarskyy) #1

Hello everyone,

I've tried to google my question but search results are flooded with articles using very basic implementation of routing.
So, let's say I have an object "product":

{ price: 100, category: 1 }

Routing based on "category" field will work as expected.

Now I change my "product" to:

{ price: 100, categories: [1,2,3] }

How routing will behave based on "categories" field? Is it safe to do it? Any side effects (except possible product duplication in search results)?
Will ES engine split an array and put product into different shards? Or will it combine all values into one (for example, "1_2_3") and put this product into a single shard?

I would be really thankful for any thoughts on this topic.

UPDATE 1: I think I found an answer to my own question. ES does not allow to have routing on array field. It throws an exception when I try to provide array for "_routing" property in bulk item. I thought I can manage to get through this exception but didn't work.


(system) #2