How to query for attributes in objects which are in an embedded array?


(Patrick) #1

Hello everybody,

i've a elasticsearch 2.4 instance which contains products in a products index. Someone else built this index and pushed the products in it.

Now i would like to create a range query by price. The problem is that the prices are stored within an embedded array. How can i query this prices (facet_float_price => v)? I couldn't figure out how to query object attributes who are contained in an array.

The indexed product documents look like this:

 {
    "_index": "products",
    "_type": "p",
    "_id": "1195449",
    "_score": 1.0,
    "_source": {
      "float_priceDiff": 0,
      "int_pricedate": 1480940837,
      "int_year": null,
      "int_deliveryDays": "1",
      "string_search": "Product name and some text",
      "facet_string": [
        {
          "k": "facet_string_brand",
          "v": null
        },
        {
          "k": "facet_string_line",
          "v": null
        }
      ],
      "facet_int": [
        {
          "k": "facet_int_brandId",
          "v": 0
        },
        {
          "k": "facet_int_categoryId",
          "v": [
            -1
          ]
        }
      ],
      "facet_boolean": [
        {
          "k": "facet_boolean_hasDeal",
          "v": false
        }
      ],
      "facet_float": [
        {
          "k": "facet_float_price",
          "v": 23.7
        }
      ]
    }
  }

Thank you very much and best regards


(system) #2

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