function build(searchTerm) {
  return {
    index: 'profiles',
    type: 'gps',
    body: {
      size: 30,
      query: {
        bool: {
          should: [
            {
              match_phrase: {
                name: {
                  query: searchTerm,
                  boost: 2,
                  slop: 1
                }
              }
            },
            {
              common: {
                name: {
                  query: searchTerm,
                  cutoff_frequency: 0.0001
                }
              }
            },
            {
              common: {
                alternativeName: {
                  query: searchTerm,
                  cutoff_frequency: 0.0001
                }
              }
            },
            {
              nested: {
                path: 'doctors',
                query: {
                  bool: {
                    should: [
                      {
                        match_phrase: {
                          'doctors.name': {
                            query: searchTerm,
                            boost: 2,
                            slop: 1
                          }
                        }
                      },
                      {
                        match: {
                          'doctors.name': {
                            query: searchTerm,
                            cutoff_frequency: 0.0001
                          }
                        }
                      }
                    ]
                  }
                },
              }
            }]
        }
      },

    }
  };
}

module.exports = {
  build,
};

@@ -366,32 +366,251 @@
 ,%0A            %7B%0A
+              match_phrase: %7B%0A                alternativeName: %7B%0A                  query: searchTerm,%0A                  boost: 2,%0A                  slop: 1%0A                %7D%0A              %7D%0A            %7D,%0A            %7B%0A
               co

Add missing phrase match