Best way to handle sub documents


(Kevin Disneur-2) #1

Hi,

I have a problematic about the best way to handle sub documents. My app
have to manipulate companies and a company can have several locations. I
must be able to find companies by their countries or their cities. I don't
need an exact address.

For now, I have the following mapping:

"mappings": {
"company" : {
"properties" : {
"name" : { "type" : "string", "store" : "yes" },
"type" : { "type" : "string", "store" : "yes" },
"employees" : { "type" : "string", "store" : "yes" },
"locations" : {
"country" : { "type" : "string", "store" : "yes" },
"city" : { "type" : "string", "store" : "yes" },
"city" : { "type" : "geo_point", "store" : "yes" },
}
}
}
}

I would like to have your feedback on several things:

  • What's the best "nested" strategy in my usecase : innerobject (like the example), nested or parent/child? Other? And why?
  • I tried the 3 possibilities but I never successfully find the results of the following query: filtering on a company type ("web agency" for example), a company size and a country. Is it possible?
  • I also use kibana to display some data, but I can't use the nested attributes in the widgets. Is it implemented?

Thanks for your help,
Kevin

--
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/d8fb6bce-5760-4a2f-a8ae-9cb7b774eccc%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #2