title: JQuery autocomplete error : Cannot read property 'label' of undefined
body: <p>With reference to <a href="https://stackoverflow.com/questions/49527724/query-auto-completion-in-c-sharp-bot-in-bot-framework/">AutoComplete in Bot Framework</a> , I had implemented GET method of search URL.</p>
  
  <p>Below is my code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;&lt;/title&gt;
  &lt;meta charset="utf-8" /&gt;
  &lt;link href="https://cdn.botframework.com/botframework- 
   webchat/latest/botchat.css" rel="stylesheet" /&gt;
  &lt;link rel="stylesheet" 
    href="http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" /&gt;
  &lt;link rel="stylesheet" 
   href="https://jqueryui.com/resources/demos/style.css"&gt;
  &lt;script src="https://code.jquery.com/jquery-1.12.4.js"&gt;&lt;/script&gt;
  &lt;script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"&gt;&lt;/script&gt;
  &lt;script src="https://cdn.botframework.com/botframework- 
  webchat/latest/botchat.js"&gt;&lt;/script&gt;
  &lt;style&gt;
      .wc-chatview-panel {
          width: 350px;
          height: 500px;
          position: relative;
      }
  &lt;/style&gt;
   &lt;/head&gt;
   &lt;body&gt;
     &lt;div id="mybot"&gt;&lt;/div&gt;
    &lt;/body&gt;
   &lt;/html&gt;
   &lt;script src="https://cdn.botframework.com/botframework- 
    webchat/latest/CognitiveServices.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript"&gt;
   var searchServiceName = "abc";
   var searchServiceApiKey = "xyzabc";
   var indexName = "index1";
   var apiVersion = "2017-11-11";
  var corsanywhere = "https://cors-anywhere.herokuapp.com/";
  
  var suggestUri = "https://" + searchServiceName + ".search.windows.net/indexes/" + indexName + "/docs/suggest?api-version=" + apiVersion + "&amp;search=how";
  var autocompleteUri = "https://" + searchServiceName + ".search.windows.net/indexes/" + indexName + "/docs/autocomplete?api-version=" + apiVersion;
  var searchUri = corsanywhere + "https://" + searchServiceName + ".search.windows.net/indexes/" + indexName + "/docs?api-version=" + apiVersion;
  
  
  BotChat.App({
      directLine: {
          secret: "DIRECTLINEKEY"
      },
      user: {
          id: 'You'
      },
      bot: {
          id: '{BOTID}'
      },
      resize: 'detect'
  }, document.getElementById("mybot"));
  
    &lt;/script&gt;
     &lt;script type="text/javascript"&gt;
          $(function () {
          $("input.wc-shellinput").autocomplete({
          source: function (request, response) {
              $.ajax({
                  type: "GET",
                  url: searchUri,
                  dataType: "json",
                  headers: {
                      "api-key": searchServiceApiKey,
                      "Content-Type": "application/json",
  
                      "Access-Control-Allow-Origin": "SAMPLEURL",
                      "Access-Control-Allow-Methods": "GET,PUT,POST,DELETE"
                  },
                  data: JSON.stringify({
                      top: 5,
                      fuzzy: false,
                      // suggesterName: "", //Suggester Name according to azure search index.
                      search: request.term
                  }),
                  success: function (data) {
                      if (data.value &amp;&amp; data.value.length &gt; 0) {
  
  
                          //RESPONSE FORMATTED as per requirements to hold questions based on input value(Below code is only for my reference i added)
                          var result = "";
                          var inputValue = request.term;
                          for (i = 0; i &lt; data.value.length; i++) {
                              var allquestions = data.value[i].questions;
  
                              if (allquestions.length &gt; 0) {
                                  for (j = 0; j &lt; allquestions.length; j++)
                                      if (allquestions[j].toLowerCase().indexOf(inputValue.toLowerCase()) != -1) {
                                          result = result + "," + allquestions[j];
                                      }
                              }
                          }
                          if (result != null) {
                              alert(result);
  
                              response(data.value.map(x =&gt; x["@search.text"])); ---Caught Error at this STEP
                          }
                          else { alert("no data"); }
  
  
  
                      }
                      else {
                          alert("No response for specific search term");
                      }
                  }
              });
          },
          minLength: 3,
          position: {
              my: "left top",
              at: "left bottom",
              collision: "fit flip"
          },
          select: function (Event, ui) {
  
              $(document).ready(function () {
  
                  var input = document.getElementsByClassName("wc-shellinput")[0];
                  var lastValue = input.value;
                  input.value = ui.item.value;
                  var event = new CustomEvent('input', {
                      bubbles: true
                  });
                  // hack React15
                  event.simulated = true;
                  // hack React16
                  var tracker = input._valueTracker;
                  if (tracker) {
                      tracker.setValue(lastValue);
                  }
  
                  input.dispatchEvent(event);
              })
  
              $('wc-textbox').val("");
              Event.preventDefault();
  
              $(".wc-send:first").click();
          }
  
      });
  });
  
  
  &lt;/script&gt;
  </code></pre>
  
  <p>My Sample API Output: </p>
  
  <pre><code>    { "@odata.context": "URL", "value": [{ "questions": [ "where are you", "where have you been", ] }, { "questions": [ "How are you?" ] } ] } 
  </code></pre>
  
  <p>I am getting API response successfully (data.value) but got exception at </p>
  
  <pre><code> response(data.value.map(x =&gt; x["@search.text"]));
  </code></pre>
  
  <p>Error Message:<strong>Uncaught TypeError: Cannot read property 'label' of undefined</strong></p>
  
  <p>I had tried replacing <em>@search.text</em> with <em>"value"</em> and <em>"@data.context"</em> but still am getting error. I want to display all questions data based on user  input</p>