What would be the best data structure for efficient search on this data?

I am using elasticsearch 1.2.0.

I have around 3 million documents which can be of 2 types - 'products' or
'categories'. Currently I am usingscript filters
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-script-filter.html to
check whether category_name1 exists in 'belongs_to_categories' array.

I have to reindex the data, so I have the opportunity to modify the
structure of the data. Any ideas how should I structure my data so that
search based on 'belongs to this category' are fastest?

My data is currently in the form -

"_type": "product",
"_source": {
"id": "id1",
...,
"name": "product_name",
"belongs_to_categories": [category_name1, category_name2]
}

"_type": "category",
"_source": {
"id": "1ID",
"name": "category_name1"
...
}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/745afc0b-7629-4845-afbe-173bffeb0842%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.