Product Opener/MongoDB indexes
(Redirected from Product Opener mongodb indexes)
⚠️ DEPRECATED: refer to openfoodfacts-server /conf/mongodb/create_indexes.js instead
https://github.com/openfoodfacts/openfoodfacts-server/blob/main/scripts/create_mongodb_indexes.pl
Note: the current indexes are probably not the best indexes, they are used on the current Open Food Facts production server and are thus "good enough", but they certainly can - and should - be improved.
In addition, some indexes are probably not used anymore and should be removed.
Help to create better indexes is much welcome! :-)
Indexes in production
01/23/2016 : MongoDB 2.4.12 on Debian Squeeze 6.0.10
> db.products.getIndexes() [ { "v" : 1, "key" : { "_id" : 1 }, "ns" : "off-fr.products", "name" : "_id_" }, { "v" : 1, "key" : { "lc" : 1 }, "ns" : "off-fr.products", "name" : "lc_1" }, { "v" : 1, "key" : { "lc" : 1, "last_modified_t" : -1 }, "ns" : "off-fr.products", "name" : "lc_1_last_modified_t_-1" }, { "v" : 1, "key" : { "lc" : 1, "last_modified_t" : 1 }, "ns" : "off-fr.products", "name" : "lc_1_last_modified_t_1" }, { "v" : 1, "key" : { "code" : 1 }, "ns" : "off-fr.products", "name" : "code_1" }, { "v" : 1, "key" : { "product_name" : 1, "generic_name" : 1, "last_modified_t" : 1, "lc" : 1, "code" : 1 }, "ns" : "off-fr.products", "name" : "product_name_1_generic_name_1_last_modified_t_1_lc_1_code_1" }, { "v" : 1, "key" : { "lc" : 1, "complete" : -1, "last_modified_t" : -1, "product_name" : 1, "generic_name" : 1 }, "ns" : "off-fr.products", "name" : "lc_1_complete_-1_last_modified_t_-1_product_name_1_generic_name_1" }, { "v" : 1, "key" : { "complete" : -1, "last_modified_t" : -1, "product_name" : 1, "generic_name" : 1 }, "ns" : "off-fr.products", "name" : "complete_-1_last_modified_t_-1_product_name_1_generic_name_1" }, { "v" : 1, "key" : { "_keywords" : 1, "complete" : -1, "last_modified_t" : -1, "product_name" : 1, "generic_name" : 1 }, "ns" : "off-fr.products", "name" : "_keywords_1_complete_-1_last_modified_t_-1_product_name_1_generic_name_1" }, { "v" : 1, "key" : { "sortkey" : -1 }, "ns" : "off-fr.products", "name" : "sortkey_-1" }, { "v" : 1, "key" : { "last_modified_t" : -1 }, "ns" : "off-fr.products", "name" : "last_modified_t_-1" }, { "v" : 1, "key" : { "created_t" : -1 }, "ns" : "off-fr.products", "name" : "created_t_-1" }, { "v" : 1, "key" : { "sortkey" : -1, "countries_tags" : 1 }, "ns" : "off-fr.products", "name" : "sortkey_-1_countries_tags_1" }, { "v" : 1, "key" : { "last_modified_t" : -1, "countries_tags" : 1 }, "ns" : "off-fr.products", "name" : "last_modified_t_-1_countries_tags_1" }, { "v" : 1, "key" : { "last_modified_t" : -1, "_keywords" : 1 }, "ns" : "off-fr.products", "name" : "last_modified_t_-1__keywords_1" }, { "v" : 1, "key" : { "sortkey" : -1, "_keywords" : 1 }, "ns" : "off-fr.products", "name" : "sortkey_-1__keywords_1" }, { "v" : 1, "key" : { "countries_tags" : 1, "sortkey" : -1 }, "ns" : "off-fr.products", "name" : "countries_tags_1_sortkey_-1" }, { "v" : 1, "key" : { "categories_tags" : 1, "sortkey" : -1 }, "ns" : "off-fr.products", "name" : "categories_tags_1_sortkey_-1" }, { "v" : 1, "key" : { "purchase_places_tags" : 1, "sortkey" : -1 }, "ns" : "off-fr.products", "name" : "purchase_places_tags_1_sortkey_-1" }, { "v" : 1, "key" : { "brands_tags" : 1, "sortkey" : -1 }, "ns" : "off-fr.products", "name" : "brands_tags_1_sortkey_-1" }, { "v" : 1, "key" : { "status_tags" : 1, "sortkey" : -1 }, "ns" : "off-fr.products", "name" : "status_tags_1_sortkey_-1" }, { "v" : 1, "key" : { "country_tags" : 1, "last_modified_t" : -1 }, "ns" : "off-fr.products", "name" : "country_tags_1_last_modified_t_-1" }, { "v" : 1, "key" : { "country_tags" : 1, "created_t" : -1 }, "ns" : "off-fr.products", "name" : "country_tags_1_created_t_-1" }, { "v" : 1, "key" : { "country_tags" : 1, "product_name" : 1 }, "ns" : "off-fr.products", "name" : "country_tags_1_product_name_1" }, { "v" : 1, "key" : { "_keywords" : 1, "product_name" : 1 }, "ns" : "off-fr.products", "name" : "_keywords_1_product_name_1" }, { "v" : 1, "key" : { "_keywords" : 1, "created_t" : -1 }, "ns" : "off-fr.products", "name" : "_keywords_1_created_t_-1" }, { "v" : 1, "key" : { "_keywords" : 1, "last_modified_t" : -1 }, "ns" : "off-fr.products", "name" : "_keywords_1_last_modified_t_-1" }, { "v" : 1, "key" : { "_keywords" : 1, "sortkey" : -1 }, "ns" : "off-fr.products", "name" : "_keywords_1_sortkey_-1" }, { "v" : 1, "key" : { "countries_tags" : 1, "product_name" : 1 }, "ns" : "off-fr.products", "name" : "countries_tags_1_product_name_1" }, { "v" : 1, "key" : { "categories_tags" : 1 }, "ns" : "off-fr.products", "name" : "categories_tags_1" }, { "v" : 1, "key" : { "sortkey" : -1, "categories_tags" : 1 }, "ns" : "off-fr.products", "name" : "sortkey_-1_categories_tags_1" }, { "v" : 1, "key" : { "categories_tags" : 1, "last_modified_t" : -1 }, "ns" : "off-fr.products", "name" : "categories_tags_1_last_modified_t_-1" }, { "v" : 1, "key" : { "brands_tags" : 1, "last_modified_t" : -1 }, "ns" : "off-fr.products", "name" : "brands_tags_1_last_modified_t_-1" }, { "v" : 1, "key" : { "status_tags" : 1, "last_modified_t" : -1 }, "ns" : "off-fr.products", "name" : "status_tags_1_last_modified_t_-1" }, { "v" : 1, "name" : "unique_scans_n_-1", "key" : { "unique_scans_n" : -1 }, "ns" : "off-fr.products" }, { "v" : 1, "name" : "unique_scans_n_-1_product_name_1_generic_name_1", "key" : { "unique_scans_n" : -1, "product_name" : 1, "generic_name" : 1 }, "ns" : "off-fr.products" } ]