Elasticsearch mapping nested vs flat.What is the better type for searching?

  Kiến thức lập trình

I’m going to store some data to Elasticsearch so what is the best type for mapping.What type is most effect for searching speed?I mean nested type and flat type mapping.I’ll put the example data here.I can’t find any document for this question.If you guys have something please comment here.

  • Nested type

       { 
        "User_name" : "John",
        "Contact"   : {
            "contact_01" : "+777000...",
            "contact_02" : "+888000..."
            } 
       }
    
  • Flat type

       { 
        "User_name" : "John",
        "contact_01" : "+777000...",
        "contact_02" : "+888000..."           
       }
    

2

LEAVE A COMMENT