0
PUT /test-product
{
  "mappings": {
    "properties": {
      "profile": {
        "type": "nested"
      },
      "product": {
        "type": "nested"
      }
    }
  }
}

i have a index that name's 'test-product'

POST /test-product/_bulk
{ "index" : { "_id" : "1" } }
{ "user":"1", "profile":{"name":"AA", "age": "11", "height": "30"}, "product": {"price": "333", "name": "test", "weight": "10"} }
{ "index" : { "_id" : "2" } }
{ "user":"2", "profile":{"name":"BB", "age": "20"}, "product": {"name": "test"}}

and that index have some docs

I want to get the results as below....

Case 1. when i search for user: 1

profile.name, profile.age, profile.height, product.price, product.name, product.weight

Case 2. when i search for user: 2

profile.name, profile.age, product.name

Is there a way?

Aaron Jin
  • 1
  • 1

1 Answers1

0

I'm not exactly sure what your requirement is for data, but all fields are available with GET <index>/_mapping. Maybe GET index_name/_mapping?pretty will better suit you.

Filip
  • 609
  • 7
  • 18