Price Range Mapping

Good morning!

Currently, we are saving documents in a single index with a nested field. This nested field represents prices and looks like the following:

'prices' => [
    'type' => 'nested',
    'properties' => [
        'date' => [
            'type' => 'date'
        ],
        'price' => [
             'type' => 'integer'
        ],
        'persons' => [
            'type' => 'integer'
        ]
    ]    
]

These kind of nested objects are expected to change frequently. Per document there can be up to 100,000 nested price objects.

Currently we have concerns about index rate/time and computing time. Is there any better approach to save this kind of data structure? We must keep the ability to filter efficiently over the prices.

Thanks in advance

You can choose to de-normalize your data and store one separate document per nested document in the structure that you mentioned. There are a few issues with this approach: All root level fields will now have to be stored in all documents, any filtering to find the count of products will need to be done using cardinality aggregation of the product id field as same product information will now be stored in multiple documents.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.