locked
Azure Search complex document type/nested document and faceting in nested fields? RRS feed

  • Question

  • I read the post: https://docs.microsoft.com/en-us/azure/search/search-howto-complex-data-types

    Based on post I know how can I search in multiple nested child doc fields. But what if I want to query nested child doc with any field in child doc and another field I want to use to display facets info(say price range). Is it possible. Faceting in child docs?

    Wednesday, September 19, 2018 8:44 AM

All replies

  • I read the post: https://docs.microsoft.com/en-us/azure/search/search-howto-complex-data-types

    Based on post I know how can I search in multiple nested child doc fields. But what if I want to query nested child doc with any field in child doc and another field I want to use to display facets info(say price range). Is it possible. Faceting in child docs?

    Could you provide your index schema (or JSON with sample data record), which fields you want to query, and which you want to facet on?

    Here is info about facet filters: https://docs.microsoft.com/en-us/azure/search/search-filters-facets

    Does that help?

    Thursday, September 20, 2018 8:01 PM
  • This is how my json will look like:

    For products data

    {

    "skuId" : "123",

    "other_product_attributes" : "",

    "store" : [

      {

      store_id: 1,

      store_price:10

      availability:true

      other_store_sttributes:""

      },

      {

      store_id: 2,

      store_price:8

      availability:true

      other_store_sttributes:""

      }

    ]

    }

    Now I want to query all products by store_id and facet on price ranges.

    Saturday, September 22, 2018 7:16 AM
  • This is how my json will look like:

    For products data

    {

    "skuId" : "123",

    "other_product_attributes" : "",

    "store" : [

      {

      store_id: 1,

      store_price:10

      availability:true

      other_store_sttributes:""

      },

      {

      store_id: 2,

      store_price:8

      availability:true

      other_store_sttributes:""

      }

    ]

    }

    Now I want to query all products by store_id and facet on price ranges.

    Can you put in search index only array of products?

    [

      {

      store_id: 1,

      store_price:10

      availability:true

      other_store_sttributes:""

      },

      {

      store_id: 2,

      store_price:8

      availability:true

      other_store_sttributes:""

      }

    ]

    Then your search index would have store_id, store_price, availability and other attributes. In schema definition you set attribute facetable=true on store_price to facet on price. Check this docs about faceting on range: https://docs.microsoft.com/en-us/azure/search/search-faceted-navigation#filter-based-on-a-range

    Let me know if that helps!

    Friday, October 5, 2018 8:30 PM