Where to find info on instant search template format?

I took the sample web app and am trying to customize it to my own app/indeces, but keep getting blanks in the item template. It returns the results but each one has blanks in the fields. I’ve tried various field syntaxes but nothing.

so if the JSON I loaded into the index has:

{

“Docs”:{
“Id”: “ca078a43-4c76-4a4e-a05e-834fbc5b8c39”,
“Application Name”: “AutoCAD Drawing”,
“FileExtension”: “DWG”,
“FilePath”: “Sample01.dwg”,
“Thumbnail”: “http://localhost:82/DWGSample01.dwg_ca078a43-4c76-4a4e-a05e-834fbc5b8c39.png”,
“ViewerImage”: “http://localhost:82/DWGSample01.dwg_ca078a43-4c76-4a4e-a05e-834fbc5b8c39.scs
}
}
I have tried the following to get results in the template:
{{FilePath}}
{{docs.FilePath}}

but only get empty cells. All docs I’ve found about templating have no detail on how to reference fields. The sample app has tags like {{name} and {{image}} which implies you fit it to the structure of the JSON in the index but as I cant see the raw data I am having issues mapping it correctly.

Hi there,

the second format you used should be valid, but I believe you have a typo in your template and should use Docs.FilePath instead of docs.FilePath

I have reformatted your json to help with readability.

[
  {
    "Docs":{
      "Id": "ca078a43-4c76-4a4e-a05e-834fbc5b8c39",
      "Application Name": "AutoCAD Drawing",
      "FileExtension": "DWG",
      "FilePath": "Sample01.dwg",
      "Thumbnail": "http://localhost:82/DWGSample01.dwg_ca078a43-4c76-4a4e-a05e-834fbc5b8c39.png",
      "ViewerImage": "http://localhost:82/DWGSample01.dwg_ca078a43-4c76-4a4e-a05e-834fbc5b8c39.scs"
    }
  }  
]

I have tested your record and the following templating code seemed to work without issue:

instantsearch.widgets.hits({
    container: '#hits',
    templates: {
      item: `
<article>
  <h1>{{Docs.FilePath}}</h1>
  <p>{{Docs.Application Name}}</p>
</article>
`,
    },
  }),

I tested specifically the Application Name field because I wasn’t sure of how it was going to behave.
You can find more about the templating syntax here:

I hope this helps you get started!