Display same document structure on two different way

Hi,

I would like to migrate my database tables into elasticsearch. I read the
first 3 chapter of the Elasticsearch Server, 2nd Edition book but honestly
I do not know how can I reach my target.

Is it possible to display same document structure on two different way? I
am giving you an example.

I have a database scheme with two tables like this:

table 1: VEHICLE
pk | make | model | description

1 | BMV | 116i | Very reliable BMW 1 series for sale

2 | Volvo | excavator | EXCAVATOR FOR SALE

table 2: DETAILS
pk | vehicle_id | key | value

1 | 1 | colour | red
2 | 1 | year | 2015
3 | 1 | mileage | 110000

4 | 2 | year | 2010
5 | 2 | hours of use | 3600

I have two sql queries:
(1) display the available vehicles
select v.make, v.model from vehicle v where

(2) generate a tag cloud for the user interface:
select d.key, count(d.key) from details d where inner join
vehicle v on v.id = d.vehicle_id group by d.key

result of sql query 2:

  • hours of usage (1)
  • year (2)
  • colour (1)
  • milage (1)

So I have created an elasticsearch index like this:
{
"settings": {
"index": {
"mapping.allow_type_wrapper": true
}
},
"mappings": {
"vehicle": {
"dynamic": "false",
"properties": {
"pk": { "type": "long", "store": "yes", "index": "no",
"null_value": -1 },
"make": { "type": "string", "store": "yes", "index": "analyzed",
"null_value": "" },
"model": { "type": "string", "store": "yes", "index": "analyzed",
"null_value": "" },
"description": { "type": "string", "store": "yes", "index": "analyzed",
"null_value": "" },
"details": {
"properties": {
"key": { "type": "string", "store": "yes", "index": "analyzed",
"null_value" : "" },
"value": { "type": "string", "store": "yes", "index": "analyzed",
"null_value": "" }
}
}
}
}
}
}

I am able to add documents and query the available vehicles from the
elasticsearch but I do not know how I can reproduce data for tag cloud with
elasticsearch.

Could you help me?

--
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/d062d153-1cd2-4317-b65a-8106d649565a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.