richardwilly98 / elasticsearch-river-mongodb

MongoDB River Plugin for ElasticSearch
1.12k stars 215 forks source link

include_fields doesn`t work correct with nested fields #204

Closed Andro999b closed 10 years ago

Andro999b commented 10 years ago

include_fields ignore all the nested fields, except for the latest. For instance I use this code for creating RIVER.

{
    "type": "mongodb",
    "mongodb": {
        "db": "market",
        "collection": "entities",
        "options": {
            "include_fields": [
                "system_info.userId",
                "place.area",
                "system_info.date",
                "place.country",
                "system_info.removed",
                "system_info.premium",
                "place.default",
                "system_info.price"
            ]
        }
    },
    "index": {
        "name": "market",
        "type": "goods"
    }
}

But only "place.default", "system_info.price" will get to the search index

MongoDB version 2.4.6 Elasticsearch vesion 0.90.10 plugin version 1.7.3

richardwilly98 commented 10 years ago

Can you post the json object structure stored in Mongo?

On Tuesday, January 21, 2014, Andro999b notifications@github.com wrote:

include_fields ignore all nested field, except last one.

For example, i use this code to create river.

{ "type": "mongodb", "mongodb": { "db": "market", "collection": "entities", "options": { "include_fields": [ "system_info.userId", "place.area", "system_info.date", "place.country", "system_info.removed", "system_info.premium", "place.default", "system_info.price" ] } }, "index": { "name": "market", "type": "goods" } }

But only "place.default", "system_info.price" will be in search index.

— Reply to this email directly or view it on GitHubhttps://github.com/richardwilly98/elasticsearch-river-mongodb/issues/204 .

Andro999b commented 10 years ago

This one for an example.

{
    "_id" : ObjectId("52ce6b144d6c41d89615e14d"),
    "gross_weight" : 0,
    "fifth_wheel_height" : 0,
    "number_of_valves" : 0,
    "number_of_cylinders" : 0,
    "net_weight" : 0,
    "truck_mounted_crane" : {
        "checkbox" : false,
        "string" : "",
        "num" : 0
    },
    "central_lubrication" : false,
    "right_hand_drive" : false,
    "mega" : false,
    "toolbox" : false,
    "adr" : false,
    "hydraulics" : false,
    "rto" : false,
    "fuel" : "",
    "euro" : 0,
    "engine_type" : "",
    "engine_volume" : 0,
    "turbo" : false,
    "intercooler" : false,
    "injector" : false,
    "fuel_tanks" : {
        "count" : 0,
        "tank1" : 0,
        "tank2" : 0,
        "tank3" : 0,
        "overall" : 0
    },
    "gearbox_type" : "",
    "gears_number" : "",
    "berth" : 0,
    "coolers" : [ ],
    "security" : [ ],
    "exterior" : [ ],
    "mirrors_glass" : [ ],
    "headlight" : [ ],
    "type_of_suspension" : "",
    "axles_number" : 0,
    "suspension_options" : [ ],
    "wheel_formula" : "",
    "axes_make" : "",
    "wheelbase" : 0,
    "brake_options" : [ ],
    "rubber" : {
        "brakes" : "",
        "rest_rpc" : 0,
        "rest_mm" : 0,
        "size" : 0
    },
    "tire_size_on_the_axes" : {
        "first_axis" : {
            "brakes" : "",
            "rest_rpc" : 0,
            "rest_mm" : 0,
            "size" : 0
        },
        "second_axis" : {
            "brakes" : "",
            "rest_rpc" : 0,
            "rest_mm" : 0,
            "size" : 0
        },
        "third_axis" : {
            "brakes" : "",
            "rest_rpc" : 0,
            "rest_mm" : 0,
            "size" : 0
        }
    },
    "spare_wheel" : [ ],
    "year" : {
        "month" : "",
        "year" : 0
    },
    "first_registration" : {
        "month" : "",
        "year" : 0
    },
    "mileage" : 0,
    "color_metallic" : {
        "color" : "",
        "metallic" : false
    },
    "fuel_consumption_l_100km" : 0,
    "engine_make" : "",
    "cabin_type" : "",
    "dimensions" : {
        "heigth" : 4,
        "width" : 3,
        "length" : 2
    },
    "mark_model" : {
        "model" : "eqwwqe",
        "mark" : "avia_daewoo"
    },
    "aut_heater" : "",
    "gearbox_make_model" : {
        "model" : "",
        "mark" : ""
    },
    "system_info" : {
        "price" : 12,
        "userId" : 227520,
        "date" : 1389218400000,
        "photos" : [ ],
        "sub_goods_refs" : [ ],
        "main_goods_ref" : "",
        "premium" : false,
        "extend_date" : 1389391200000,
        "expire_date" : 1394575200000,
        "removed" : false
    },
    "price" : {
        "price" : 12,
        "vat_percent" : 0,
        "currency" : "uah"
    },
    "description" : {
        "lng" : "ru",
        "text" : "sadzxczxc"
    },
    "place" : {
        "country" : "6",
        "area" : "127",
        "default" : false
    },
    "_model" : "$category_5200b707916c1489c4487bbd"
}
richardwilly98 commented 10 years ago

@Andro999b Please try release 1.7.4 just released. BTW - this release has been tested on ES 0.90.10 only.