We are considering using Elastic Search for an upcoming project. I have done quite a bit of research on the API and am curious about a few things as they relate to a specific but very necessary use-case for the project. If we cannot satisy this use-case I do not think ES will be right for us.
My research has led to me to using a *parent/child relationship* and the *has_child* query (I also looked at the 'nested' and 'inner object'). But I am not sure if this is the best approach as I am still wrapping my head around how to best strategize for Elastic Search and denormalize my data. We currently have a relational database in place and are planning on setting up Elastic Search to run along-side this DB as our search repository. The use-case is as follows: * We are storing product information (300,000+ products) as type 'product'. * We are also storing inventory data for 20,000+ retailers. * Each product has a set of UPCs and each retailer has a list of UPCs they carry along with the quantities in stock. * The 'product_retailers' type stores ALL of the retailers who carry the parent product. This will be re-indexed very often (at least once an hour for each product) * The document model I am proposing we use: $ curl -XPUT 'http://localhost:9200/products/product/1' -d '{ { 'name' : 'Foo', 'description' : 'Bar...', ... }' $ curl -XPUT 'http://localhost:9200/products/product_retailers/_mapping' -d ' { { "product_retailers":{ "_parent":{ "type" : "product" } } } }' $ curl -XPUT 'http://localhost:9200/products/product_retailers/?parent=1' -d ' { { "id" : 888, // the retailer id "upcs" : { { "code" : 123456789012, "quantity" : 22 }, { "code" : 123456789013, "quantity" : 19 }, { "code" : 123456789014, "quantity" : 27 }, ... } }, { "id" : 889, // the retailer id "upcs" : { { "code" : 123456789012, "quantity" : 11 }, { "code" : 123456789013, "quantity" : 2 }, { "code" : 123456789014, "quantity" : 1 }, ... } } }' * We need to be able to filter product results (based on keyword matches) filtered against a set of retailer IDs for whom have the product in stock. * Another way to put it, given a list of retailer ids and a search keyphrase we need to be able to return matching products. * A huge bonus would be to ALSO include the data about the matching retailers in the result set. Is this even possible with ES? Am I going about modeling my data correctly so that it can scale well to the quantity of items we are storing. -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/bd2d9424-af9b-442f-9a30-919a250133f9%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
