¶ Running the example setup kit and proving ElasticSearch is functional for development
- Download the Elastic search startup kit created by James Gray
- Extract the zip to a folder
- There is a ReadMe.txt file that includes the following instructions
(this wiki copy may be more up-to-date):
- On "jre-8u144-windows-x64.exe", Double-Click or Right-Click > Run
as administrator
- Click Install
- Wait for install to complete
- Click Close
- On "elasticsearch-5.5.1.msi", Double-Click or Right-Click >
Install
- Click Next (Leave "Use the default directories" checked)
- Change Account Information to: "Use NT AUTHORITY\NETWORK SERVICE"
- Click Next (leave "Install as a Service" and both "Start the
service..." check-boxes checked)
- Change the Memory to a larger value like 4GB
- Click Next (Leave the rest of this screen alone)
- Click Install (do not check any additional packages)
- Wait for install to complete
- Click the "Open in Browser..." link to test that it installed
properly
- If you have issues after attempting to open in browser, try
rebooting your machine before you uninstall and reinstall
- Click OK/Close
- Note: Kibana is not required, but it makes it much easier to test
querying the system
- Extract Kibana if not already extracted
- Navigate into the [Kibana] > bin folder
- On "kibana.bat", Double-Click or Right-Click > Open
- The command prompt will open and start Kibana
- Warning: Kibana is only running while this command prompt is
running. If you close it, the "service" will stop
- Open http://localhost:5601/ in your browser
- Enter `*` into the search field
- Select "I don't want to use the time field"
- Click Save
- Click Dev Tools from the Left Nav
- Read the Welcome to Console message
- Click "Get to work"
- Run the query provided to see some results
- Example Queries for CEF:
- GET /_cat/indices?v&s=index&index=product-search*
- GET /_cat/aliases?v&s=index&alias=product-search*
- Extract the example project it not already extracted
- Navigate into [Example] > src
- On "NuSearch.sln", Double-Click or Right-Click > Open
- On the "NuSearch.Indexer" project, Right-Click > Set as Startup
Project
- Under the "NuSearch.Indexer" project, open Program.cs
- Change the path on the DumpReader to where your example's folder is
located into the "\src\NuSearch.Web\NuGetData" path from the
drive root
- Start the solution (F5)
- A Command Prompt will open and state that it is indexing documents.
Multiple "." will show as it progresses.
- Wait for the "Done Indexing nested Packages" message
- Press Enter to exit (you may have to press it twice)
- On the "NuSearch.Web" project, Right-Click > Set as Startup
Project
- Start the solution (F5)
- Open http://localhost:8080/ in your browser
- Search for json
- As you type, suggestions will come up
- Change your sort to Number of downloads from Relevance
- Change the page size to 10
- Click the third author "James Newton-King"
- Your first 2 results should be "Newtonsoft.Json" and "JSON"
You will need the following app settings to work with the new Search
Catalog in CEF:
<add key="Clarity.Ecommerce.Searching.ElasticSearch.Uri" value="localhost" />
<add key="Clarity.Ecommerce.Searching.ElasticSearch.Port" value="9200" />
<add key="Clarity.Ecommerce.Searching.ProductIndex.Old" value="product-search-dfo-prs-old" />
<add key="Clarity.Ecommerce.Searching.ProductIndex" value="product-search-dfo-prs" />
<add key="Clarity.Ecommerce.Searching.FilterByCategories" value="true" />
<add key="Clarity.Ecommerce.Searching.FilterByStores" value="false" />
<add key="Clarity.Ecommerce.Searching.FilterByTypeKeys" value="" />
<add key="Clarity.Ecommerce.Searching.StoreIndex.Old" value="store-search-dfo-prs-old" />
<add key="Clarity.Ecommerce.Searching.StoreIndex" value="store-search-dfo-prs" />
<add key="Clarity.Ecommerce.Searching.StoreIndex.FilterByTypeKeys" value="" />
<add key="Clarity.Ecommerce.Searching.Kibana.Host.Uri" value="localhost" />
<add key="Clarity.Ecommerce.Searching.Kibana.Host.Port" value="5601" />
The `product-search-dfo-prs` should be replaced with a unique name per
site (start with `product-search-` and use something like the project
code), same for `store-search-`.
After these settings are entered in both the service project and the
elastic search testing project, you will be able to run an index from
the elastic search testing project (See a Back End developer for
assistance running the index) and then open the search catalog page to
see results.
The default demo site has the page currently at /Search-Catalog . If you
need to use it on a different page, set the page to use the
Search-Catalog skin file and it should handle itself just by going to
the page.
- The number 1 cause of issues with the search running and returning
results successfully is bad data. The data has to be in a reasonably
good state before it can be indexed and searched against. Any
instances against the "norm" like missing descriptions, bad
whitespace in/around the names of products and categories, etc will
all make the results weird or just not work at all. Please audit the
data you are working with to massage it into a good state. You may
need to push back on your client to fix their data.
- Categories *must* have unique custom keys present on the records.
No custom key on the Category (a null or blank value) will cause
issues with the indexing (it will succeed but not be usable
properly) and user interface (you will click on categories in the
category catalog and they won't do anything/what they are supposed
to do).
- This is required to get around issues with duplicate category
names. Even if your client's data doesn't have duplicate
category names, you still have to do this.
- The setting to control how many categories are required before
showing products in the catalog is in the cef.js (under
configurations) and can be overridden using an overriding cef.js in
the skin folder (like any HTML template). The path is
catalog.showCategoriesForLevelsUpTo and takes a number. The default
value if not present is 1 and the search catalog can support values
from 1-7 officially (0 is possible but not officially supported).
- There is a significant section of code dedicated to supporting
these 1-7 layers as-is and customized adjustments will be
time-consuming, so try to stay within the guidelines where
possible.
- This setting is static and does not allow some categories that
have fewer than this number of levels in their tree branch to
function "just to the level they have", it must be a consistent
starting point available on all branches. Work with your client
to adjust their category structure to support this.
- There is currently no way to only index categories of a specific
type in (it does all categories linked to products). If you need
this feature, please ask James N. to gather the feature
requirements. You may be able to get away with only displaying the
categories of the specific types using the HTML.
- Enable an index runner from Admin
- Note: With the nightly task run to index data, you can trigger
it if you have the scheduler set up to run at any time. It
should also occur automatically on any product create/update
action/event like when coming in from connect or saving it in
CEF Admin.
- Add an iframe'd link to Kibana in the admin like we do for the
scheduler and reporting