<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Roxanne Lee</title>
    <description>The latest articles on DEV Community by Roxanne Lee (@rclee).</description>
    <link>https://dev.to/rclee</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F703096%2F51baa37e-2440-46f9-9667-ad53644b1498.png</url>
      <title>DEV Community: Roxanne Lee</title>
      <link>https://dev.to/rclee</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rclee"/>
    <language>en</language>
    <item>
      <title>ElasticSearch Continued #1</title>
      <dc:creator>Roxanne Lee</dc:creator>
      <pubDate>Sat, 18 Mar 2023 13:14:49 +0000</pubDate>
      <link>https://dev.to/rclee/elasticsearch-continued-1-1a9m</link>
      <guid>https://dev.to/rclee/elasticsearch-continued-1-1a9m</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;My previous blog posts have chronicled my journey with ElasticSearch, starting from my early experiences using it in the &lt;a href="https://telescope.cdot.systems/"&gt;Telescope&lt;/a&gt; open-source project. It's amazing to think that after almost a year, I still have the privilege of working with this powerful search and analytics engine as part of my job.&lt;/p&gt;

&lt;p&gt;This month, I am fortunate enough to attend specialized ElasticSearch courses that are fully funded by my workplace. The courses are led by industry experts, giving me a unique opportunity to gain an in-depth understanding of ElasticSearch and its many features. &lt;/p&gt;

&lt;p&gt;Although ElasticSearch is &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/3800"&gt;planned to be removed&lt;/a&gt; from Telescope, it seems fitting to share some of the key takeaways and new knowledge that I have gained. While I'm not sure how many posts there will be, I am excited to continue exploring and expanding my understanding of this powerful tool, especially in revising my explanation of how auto-complete indexing works.&lt;/p&gt;




&lt;h2&gt;
  
  
  Text Analysis
&lt;/h2&gt;

&lt;p&gt;Text analysis is utilized in two scenarios: indexing text and querying search with text. This can be done through &lt;code&gt;analyzers&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Anatomy of an Analyzer
&lt;/h3&gt;

&lt;p&gt;In general, an &lt;code&gt;analyzer&lt;/code&gt; can be considered as a bundled configuration for character filters, tokenizer, and token filters.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Sequential flow of text analysis:
          ___________        ___________        _________  tokens 
         |           |      |           |      |         | ------&amp;gt;  Index 
Text --&amp;gt; | Character | ---&amp;gt; | Tokenizer | ---&amp;gt; |  Token  |          
         |  Filters  |      |           |      | Filters |  query       
         |___________|      |___________|      |_________| ------&amp;gt;  Search 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-charfilters.html"&gt;Character Filters&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;Are used for pre-processing text before it is sent to the tokenizer. &lt;br&gt;
Some built in character filters include&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-htmlstrip-charfilter.html"&gt;HTML Strip Character Filter&lt;/a&gt; to strip out HTML elements&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-mapping-charfilter.html"&gt;Mapping Character Filter&lt;/a&gt; to replace based on specified strings&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-pattern-replace-charfilter.html"&gt;Pattern Replace Character Filter&lt;/a&gt; to replace based on regex patterns&lt;/li&gt;
&lt;/ul&gt;




&lt;h4&gt;
  
  
  &lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-tokenizers.html"&gt;Tokenizer&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;A tokenizer is the component that is in charge of separating a sequence of characters into distinct tokens (commonly words), and produce a stream of tokens as the output. It is worth noting that an analyzer must have and can only have a single tokenizer.&lt;/p&gt;

&lt;p&gt;Besides being able to create &lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-custom-analyzer.html"&gt;Custom Tokenizers&lt;/a&gt;, commonly used built-in tokenizers include&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-standard-tokenizer.html"&gt;Standard Tokenizer&lt;/a&gt; for grammar-based tokenization&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-keyword-tokenizer.html"&gt;Keyword Tokenizer&lt;/a&gt; which outputs the whole text as a single token&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-whitespace-tokenizer.html"&gt;Whitespace Tokenizer&lt;/a&gt; breaks text by whitespace&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-pattern-tokenizer.html"&gt;Pattern Tokenizer&lt;/a&gt; splits text based on Java regex&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-uaxurlemail-tokenizer.html"&gt;UAX URL Email Tokenizer&lt;/a&gt; the standard tokenizer while also being able to recognize URLs and emails. &lt;/li&gt;
&lt;/ul&gt;




&lt;h4&gt;
  
  
  &lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-tokenfilters.html"&gt;Token Filters&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;Token filters continue to process the token stream, and may remove, edit or add new tokens based on the filter. &lt;br&gt;
Some filters include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-lowercase-tokenfilter.html"&gt;lowercase&lt;/a&gt; - to switch all to characters to lower case&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-ngram-tokenfilter.html"&gt;ngram&lt;/a&gt;/&lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-edgengram-tokenfilter.html"&gt;edge-ngram&lt;/a&gt; - for splitting the token into ngram chunks&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-snowball-tokenfilter.html"&gt;stemmer&lt;/a&gt;/&lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-snowball-tokenfilter.htmle"&gt;snowball&lt;/a&gt; - stemming text to reduce words to its root form&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-hunspell-tokenfilter.html"&gt;hunspell&lt;/a&gt; - dictionary-based text stemming&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-stop-tokenfilter.html"&gt;stop&lt;/a&gt; removes stop words from the stream such as "a", "and", "the", etc. &lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  What we have in Telescope
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PUT /posts
{
  "settings": {
    "analysis": {
      "analyzer": {
        "autocomplete_analyzer": {
          "tokenizer": "autocomplete",
          "filter": ["lowercase", "remove_duplicates"]
        },
        "autocomplete_search_analyzer": {
          "tokenizer": "lowercase"
        }
      },
     "tokenizer": {
        "autocomplete": {
          "type": "edge_ngram",
          "min_gram": 1,
          "max_gram": 20,
          "token_chars": ["letter", "digit"]
        }
      }
    }
  },
  "mappings": {
    ...
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Breaking down the &lt;code&gt;Posts&lt;/code&gt; index in Telescope, we have &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Two custom &lt;code&gt;analyzers&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;One named &lt;strong&gt;autocomplete_search_analyzer&lt;/strong&gt; that doesn't have any &lt;code&gt;character filters&lt;/code&gt; or extra &lt;code&gt;token filters&lt;/code&gt;, as it uses the built-in &lt;code&gt;lowercase tokenizer&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;One named &lt;strong&gt;autocomplete_analyzer&lt;/strong&gt;, which uses our &lt;code&gt;custom tokenizer&lt;/code&gt;, &lt;strong&gt;autocomplete&lt;/strong&gt;, which includes a customized setting for the &lt;code&gt;edge_ngram&lt;/code&gt; type. Our &lt;code&gt;analyzer&lt;/code&gt; also includes built-in &lt;code&gt;lowercase&lt;/code&gt; and &lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-remove-duplicates-tokenfilter.html"&gt;&lt;code&gt;remove  duplicates&lt;/code&gt;&lt;/a&gt; token filter&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  To be continued
&lt;/h2&gt;

&lt;p&gt;For now, this is all I have time for. In later blogs, I'll continue to try and share my findings on text analysis for auto-completion, including insights on &lt;code&gt;ngrams&lt;/code&gt;/&lt;code&gt;edge-ngrams&lt;/code&gt; and index &lt;code&gt;mappings&lt;/code&gt;.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Release 3.0 - OSD700 Recap</title>
      <dc:creator>Roxanne Lee</dc:creator>
      <pubDate>Sat, 23 Apr 2022 07:02:29 +0000</pubDate>
      <link>https://dev.to/rclee/release-30-osd700-recap-2fd</link>
      <guid>https://dev.to/rclee/release-30-osd700-recap-2fd</guid>
      <description>&lt;p&gt;This blog is not really technical.&lt;/p&gt;

&lt;p&gt;So, the release happened, and also not during a final, so I got to witness it. Its not perfect yet, but fixes will happen, and its not really what this blog is about. &lt;/p&gt;




&lt;h2&gt;
  
  
  Take OSD700
&lt;/h2&gt;

&lt;p&gt;To get straight to the point. If you, dear reader, happened to stumble here cause you're still trying to decide if you should take this course or not. Short answer is "just take it". &lt;/p&gt;

&lt;p&gt;Here's my metaphor of OSD700. You come in, you're thrust with a bunch of people, but no worries, you'll get to know them soon enough cause these are your co-parents for the next few months. "&lt;a href="https://github.com/Seneca-CDOT/telescope"&gt;Telescope&lt;/a&gt;", or whichever project for your class, is now your new adopted child, imperfect, but beautiful in its own way. It's your job to take care of it, and your responsibility to make sure it stays alive and healthy. Obviously, as a kid, Telescope is very fragile and needs a lot of attention, and if you ever feed it anything bad, be sure to be prepared for all the tantrums that follows. &lt;/p&gt;

&lt;p&gt;This course is like no other. All throughout the semester there is this sense of comradeship. You're all in this together, you don't have to worry about keeping your code away from one another, and its more about sharing your research and experiences with each other. This gets stuff done more efficiently, and you'll never have to feel like you're alone. &lt;/p&gt;

&lt;p&gt;Fair warning though. A team can only carry you so far. You, yourself, will have to break out of your comfort zone and get passed that initial feeling of inconfidence and awkwardness of reaching out for help. And, even though there might always be some people who are seemingly on a whole other level, in the end, all that matters is how much you've learned and have grown.&lt;/p&gt;




&lt;h2&gt;
  
  
  My Change
&lt;/h2&gt;

&lt;p&gt;At the beginning of the semester I was utterly clueless to what "Telescope" is, and immensely frightened. Before the grades came out I had thought I had flunked OSD600, and me coming back for more in 700 just felt like going for something way out of my league. Not to mention all the confusion and all these questions in my head. Like, what in the world was "Docker", or "Nginx", or "Redis", or "Traefik", or "Elasticsearch"? What about all these microservices and what do they do, and how do they even work with each other? And, whoa, there's also something called a "Satellite"?&lt;/p&gt;

&lt;p&gt;But now after 14 weeks of experimenting and sorting out the threads, I've come out a whole new person. I know the insides and out of the &lt;code&gt;Search&lt;/code&gt; service, made friends with &lt;a href="https://jestjs.io/"&gt;Jest&lt;/a&gt;, and became intimate with &lt;a href="https://www.elastic.co/"&gt;Elasticsearch&lt;/a&gt; on a level I would never have imagined. Along the way I became familiar with the nuts and bolts of our back-end (&lt;code&gt;Parser&lt;/code&gt;), and got comfortable in working with tools like &lt;a href="https://www.docker.com/"&gt;Docker&lt;/a&gt;, &lt;a href="https://www.nginx.com/"&gt;Nginx&lt;/a&gt;, &lt;a href="https://redis.io/"&gt;Redis&lt;/a&gt;, and &lt;a href="https://traefik.io/"&gt;Traefik&lt;/a&gt;. I even poked a bit in &lt;code&gt;Satellite&lt;/code&gt;, and had a taste of working with the front-end. There was also that time when I was Sheriff... I might not have enjoyed it as much as others, but it was a different experience and it kept me on my toes. Not to mention the large amounts and variety of PRs that I had a chance to take a look at and learn from. &lt;/p&gt;

&lt;p&gt;Undoubtedly, I was lucky to get to work with a huge group of talented people. You can read all their blogs on &lt;a href="https://telescope.cdot.systems/"&gt;Telescope&lt;/a&gt; itself, or you can check them out selectively on the repo &lt;a href="https://github.com/Seneca-CDOT/telescope/wiki/Winter-2022---Telescope-3.0"&gt;wiki&lt;/a&gt;. We also got a lot of support from alumni, and of course the Prof (&lt;a href="https://github.com/humphd"&gt;humphd&lt;/a&gt;) himself. To this day I am still amazed how he can still keep on top of things with so much going on. &lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;For me, working on Telescope is a roller coaster of emotions. Sometimes its fun, then the next second, tortuous. Finishing the code could be exhilarating, but not breaking through could be agonizing. Sometimes I'd look forward to the next issues to work on, but there are also times when I want to pretend the project doesn't exist. Undoubtedly, the scale definitely tips more towards the positive side. Plus, the amount of fluidity and uncertainty in open source projects like these is just another aspect to the uniqueness of this course. &lt;/p&gt;

&lt;p&gt;I'll probably stick around especially for Elasticsearch related things, but I might try dip my toes in other areas without the pressure of trying to get things done for the next release. &lt;/p&gt;

&lt;p&gt;All in all, its the best course that Seneca could ever offer, and I'm glad I stuck with it. Even you, dear reader, student or not, Telescope is always there with open arms. Consider &lt;a href="https://github.com/Seneca-CDOT/telescope"&gt;contributing&lt;/a&gt; today!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Release 3.0 Pre</title>
      <dc:creator>Roxanne Lee</dc:creator>
      <pubDate>Thu, 21 Apr 2022 04:36:30 +0000</pubDate>
      <link>https://dev.to/rclee/release-30-pre-2p8h</link>
      <guid>https://dev.to/rclee/release-30-pre-2p8h</guid>
      <description>&lt;p&gt;The last two weeks for the last release, everyone's busy with other assignments and finals, and including me as well. When I envisioned 3.0 I had thought that we'd have something stable and it'd be more about putting in tests, smoothing out docs and maybe dealing with a few critical bug fixes. But, its seems that we're still trying to cram a lot of major stuff in this release. Changes that make it seem like I have to know Telescope again, as if I've never worked on it this semester. But, maybe more on this later. &lt;/p&gt;




&lt;h2&gt;
  
  
  Indexer tests
&lt;/h2&gt;

&lt;p&gt;The last set of issues for me adding in autocomplete indexing is to &lt;a href="https://github.com/Seneca-CDOT/telescope/pull/3490"&gt;add unit tests for our &lt;code&gt;Indexer&lt;/code&gt;&lt;/a&gt;. The tests might not seem like much, but ElasticSearch-mock was at it again, playing around with me for "old times sake". As I had probably mentioned blogs ago, ES-mock is rather strict with its mocking. If it doesn't like the request that it's detected, it'll complain. &lt;/p&gt;

&lt;p&gt;When for indexing it was trying to translate console commands to javascript, for mocking it was the other way around. Sometimes the ElasticSearch documentation aren't really that helpful either. Like the &lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html"&gt;&lt;code&gt;create&lt;/code&gt; api, for example&lt;/a&gt;, there's four possible requests. &lt;/p&gt;

&lt;p&gt;Anyways, I eventually found a way to deal with the horrifying &lt;code&gt;mock-not-found&lt;/code&gt; error. For any future playmates of ES-mock that happen to stumble upon this blog, if you ever get that error, just console log &lt;code&gt;error.meta.meta.request&lt;/code&gt;, and you'll see the correct request path that its trying to call.&lt;/p&gt;

&lt;p&gt;It was also neat I got to play with spying on &lt;code&gt;logger&lt;/code&gt; for these tests. Just remember to also &lt;code&gt;jest.clearAllMocks();&lt;/code&gt; after each unit test, or the log spies will interfere with one another. &lt;/p&gt;




&lt;h2&gt;
  
  
  Search service README
&lt;/h2&gt;

&lt;p&gt;A smaller documentation PR I did was to update the &lt;a href="https://github.com/Seneca-CDOT/telescope/pull/3524"&gt;Search readme&lt;/a&gt;. Technically its partially my fault for not having kept it up to date when I made all those changes in Search. &lt;/p&gt;

&lt;p&gt;I had initially wanted to do a bit more for this Search README, and maybe set the service up with a &lt;code&gt;dev&lt;/code&gt; script and document in the README how it can be used. Kind of like how I had written it in a &lt;a href="https://dev.to/rclee/28-update-elasticsearch-research-5dgj"&gt;previous blog&lt;/a&gt;. In order to make it useful I'd have to know which docker images needed to be run for Search to fully function (with results). But, as I had mentioned above, quite a bit of new stuff has been merged into this last release, that I am not even sure anymore. So, maybe when things are more stable and clear, I can get back to it. &lt;/p&gt;




&lt;p&gt;On a side note, a rather cool PR that I reviewed was on a &lt;a href="https://github.com/Seneca-CDOT/telescope/pull/3455"&gt;CloudFormation template&lt;/a&gt;. I think it might be nice for future students who also work on potatoes for Telescope. Just please do remember to delete the stack when done working. &lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;I have a final during the time when the release is scheduled to happen. So, all I can say now is, fingers crossed, I hope everything goes smoothly. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>3.0-alpha Autocomplete front-end</title>
      <dc:creator>Roxanne Lee</dc:creator>
      <pubDate>Thu, 21 Apr 2022 03:37:03 +0000</pubDate>
      <link>https://dev.to/rclee/30-alpha-autocomplete-front-end-2nd6</link>
      <guid>https://dev.to/rclee/30-alpha-autocomplete-front-end-2nd6</guid>
      <description>&lt;p&gt;In 2.9 a few things had happened. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Authors autocomplete indexing was added in the back-end.&lt;/li&gt;
&lt;li&gt;A new authors autocomplete query was created for &lt;code&gt;Search&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Parser&lt;/code&gt; service booted up.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So in 3.0 alpha I had a few things I needed to deal with. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://github.com/Seneca-CDOT/telescope/pull/3414"&gt;Implement autocomplete in the front-end&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/Seneca-CDOT/telescope/pull/3417"&gt;Add tests for the new query in Search &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/Seneca-CDOT/telescope/pull/3416"&gt;Add autocomplete indexing in Parser&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;#2 and #3 I wasn't too fazed. For #3, it was basically just a copy- paste. As long as Parser was working correctly before, adding the indexing would work. For Search tests, well, at this point ES-mock and I are already quite familiar with each other, in terms of mocking the ES search query. &lt;/p&gt;

&lt;p&gt;As for front-end. I honestly wasn't all that prepared to do it. I thought I had swore myself off of React and front-end on week 2 of this course, but I guess, since I put in the back-end, it was sort of all part of a package deal. &lt;/p&gt;




&lt;h2&gt;
  
  
  Front End Logic
&lt;/h2&gt;

&lt;p&gt;The logic was very simple. Each time (or rather, every few seconds) the search text has changed, we get the results from our Search service API, and list the results for the user to choose from.&lt;/p&gt;

&lt;p&gt;I'd just like to take note of a fancy trick that the OSD600 me didn't know about but had also ran into with &lt;code&gt;useEffect&lt;/code&gt;, it looks something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="nx"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// debounce so it searches every 0.5 seconds, instead of on every stroke&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;debounce&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;prepareUrl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;searchServiceUrl&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/authors/autocomplete/?author=&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="c1"&gt;// Do the request if there is something to search for&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;shouldFetch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;fetchResults&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;shouldFetch&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;prepareUrl&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nx"&gt;setOptions&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;})();&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I mostly just want to point out the &lt;code&gt;(func)();&lt;/code&gt; part, which I honestly have no idea what the name of is. But back in OSD600 I had ran into a similar problem with trying to call a fetch function in &lt;code&gt;useEffect&lt;/code&gt;. I'm just really amazed that a trick like this works. &lt;/p&gt;

&lt;p&gt;For my version I had tried to use &lt;code&gt;useSWR&lt;/code&gt;, cause that's what all the other components were using. But, it was acting too weird for me. For starters, it wouldn't try to get the API results on the right change. For example if I typed "Ro", it would only look for results starting with "R". There also seemed to be some weird debounce problems where deleting a search text with backspace would fire the fetch with every keystroke instead of every 0.5 seconds. So in the end, I looked for an alternative route with the old &lt;code&gt;fetch&lt;/code&gt; and &lt;code&gt;useEffect&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://mui.com/material-ui/react-autocomplete/"&gt;MUI Autocomplete Component&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;I chose to use this component since its supposed to be the fallback if I never got autocomplete indexing in. The original idea was we could probably feed it a static list of authors, and let it do its version of an autocomplete thing. So now it'll also serve as a fallback if one day ElasticSearch gets ripped out for some reason.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In all honestly, I can't decide if its front-end in general or Telescope front-end in particular that I'm not really too fond of tackling. However, besides styling, which I admit I am just horrible at, I felt my code did what it needed to do. Mostly proud that I got it working so it doesn't search on the wrong text and it also doesn't fire with every keystroke, including backspace.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>2.9 - ElasticSearch Autocomplete Indexing</title>
      <dc:creator>Roxanne Lee</dc:creator>
      <pubDate>Sat, 02 Apr 2022 01:54:10 +0000</pubDate>
      <link>https://dev.to/rclee/29-elasticsearch-autocomplete-indexing-243j</link>
      <guid>https://dev.to/rclee/29-elasticsearch-autocomplete-indexing-243j</guid>
      <description>&lt;p&gt;&lt;a href="https://github.com/Seneca-CDOT/telescope/releases/tag/2.9.0"&gt;Release 2.9&lt;/a&gt; was a partial success on my part, cause in the end I did manage to get &lt;a href="https://github.com/Seneca-CDOT/telescope/pull/3301"&gt;&lt;code&gt;Author&lt;/code&gt; autocomplete indexing&lt;/a&gt; into the back-end.&lt;/p&gt;

&lt;p&gt;Admittedly, I've put this blog off a little too long. Partly, because my other courses needed my explicit attention lest I want to fail them all, but also, because I'm rather afraid of having to explain just exactly how I got it working.&lt;/p&gt;

&lt;p&gt;A long story short, lots of time playing around in the Kibana dev tools, lots of time pouring into the oddly structured ElasticSearch documentation, and lots of time waiting for docker images to be rebuilt and posts to be re-indexed. All in all, many many trial and errors. &lt;/p&gt;

&lt;p&gt;But why does it work? Well, that's a whole other story. I can not guarantee complete accuracy, and can only explain it to how I understand it. &lt;/p&gt;

&lt;h2&gt;
  
  
  Explaining the code
&lt;/h2&gt;

&lt;p&gt;To begin with, here's the code, and in case this ever gets lost, the &lt;a href="https://github.com/Seneca-CDOT/telescope/blob/2bb611eae1344bbaecadad9bd84be165ea2b663a/src/backend/utils/indexer.js#L11-L89"&gt;permalink to the code&lt;/a&gt; with a huge blob of comment consisting of many links to various documentation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;setupPostsIndex&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;indices&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exists&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="c1"&gt;// If the index doesn't exist, 404 statusCode is returned&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;statusCode&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;404&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;indices&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;create&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
        &lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="na"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;analysis&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
              &lt;span class="na"&gt;analyzer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="na"&gt;autocomplete_analyzer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                  &lt;span class="na"&gt;tokenizer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;autocomplete&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="na"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;lowercase&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;remove_duplicates&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
                &lt;span class="p"&gt;},&lt;/span&gt;
                &lt;span class="na"&gt;autocomplete_search_analyzer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                  &lt;span class="na"&gt;tokenizer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;lowercase&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="p"&gt;},&lt;/span&gt;
              &lt;span class="p"&gt;},&lt;/span&gt;
              &lt;span class="na"&gt;tokenizer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="na"&gt;autocomplete&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                  &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;edge_ngram&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="na"&gt;min_gram&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="na"&gt;max_gram&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="na"&gt;token_chars&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;letter&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;digit&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
                &lt;span class="p"&gt;},&lt;/span&gt;
              &lt;span class="p"&gt;},&lt;/span&gt;
            &lt;span class="p"&gt;},&lt;/span&gt;
          &lt;span class="p"&gt;},&lt;/span&gt;
          &lt;span class="na"&gt;mappings&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;properties&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
              &lt;span class="na"&gt;author&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;fields&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                  &lt;span class="na"&gt;autocomplete&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="na"&gt;analyzer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;autocomplete_analyzer&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="na"&gt;search_analyzer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;autocomplete_search_analyzer&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="p"&gt;},&lt;/span&gt;
                &lt;span class="p"&gt;},&lt;/span&gt;
                &lt;span class="na"&gt;analyzer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;standard&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
              &lt;span class="p"&gt;},&lt;/span&gt;
            &lt;span class="p"&gt;},&lt;/span&gt;
          &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="s2"&gt;`Error setting up &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; index`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For starters, ElasticSearch will complain if we try to create an index if it already exists. To save ourselves from the error spam in case ElasticSearch data was stored and the index already exists, an extra if-statement was added.&lt;/p&gt;

&lt;p&gt;It was decided to use the &lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-edgengram-tokenizer.html"&gt;Edge N-gram tokenizer&lt;/a&gt;. To make use of that we'd need to set up a &lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-custom-analyzer.html"&gt;custom analyzer&lt;/a&gt; which would be set to use our custom &lt;a href="https://www.google.com/search?client=firefox-b-d&amp;amp;q=elasticsearch+tokenizer"&gt;tokenizer&lt;/a&gt; of the &lt;code&gt;Edge N-gram&lt;/code&gt; type and with our chosen settings. All of this is to be done in the &lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis.html"&gt;analysis&lt;/a&gt; process inside of index &lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#index-modules-settings"&gt;settings&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;After that, we'd need to specifically &lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/explicit-mapping.html"&gt;map&lt;/a&gt; which &lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/properties.html"&gt;properties&lt;/a&gt; (in this case, &lt;code&gt;author&lt;/code&gt;) are to use the custom analyzer. For Telescope, I used a trick to designate a custom &lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-fields.html"&gt;field&lt;/a&gt; inside the &lt;code&gt;author&lt;/code&gt; property to use the custom analyzers instead. This way, our original search query on the index wouldn't be affected. &lt;/p&gt;

&lt;p&gt;The decision to create an index instead of updating the already existing index is because&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The &lt;code&gt;index.create()&lt;/code&gt; function we use to index posts will create the index (if it doesn't already exist), and add a document to this index. If there weren't any previous settings and mappings, it'd only apply the standard options. &lt;/li&gt;
&lt;li&gt;We can &lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html#update-settings-analysis"&gt;only update an index setting on a closed index&lt;/a&gt;, this would involve closing, updating, and re-opening the index. &lt;/li&gt;
&lt;li&gt;Furthermore, the &lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-update-settings.html"&gt;Update Settings API&lt;/a&gt; hasn't been implemented yet.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now with this new indexing, while searching, instead of querying on the &lt;code&gt;author&lt;/code&gt; property for an exact match, we can now search on the &lt;code&gt;author.autocomplete&lt;/code&gt; field for more detailed, possible matches.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="nx"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;match&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;author.autocomplete&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="na"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;author&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;operator&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;and&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="nx"&gt;highlight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;fields&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;author.autocomplete&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{},&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/highlighting.html"&gt;highlight&lt;/a&gt; is an ES Search option to show where the query matches are in the search results of our designated field. &lt;/p&gt;

&lt;p&gt;Since each author could have more than one post, we had a problem with multiples of the same author showing up in the queries. &lt;a href="https://github.com/manekenpix"&gt;Josue&lt;/a&gt; (alumni) introduced me to the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce"&gt;reduce()&lt;/a&gt; function as a possibility to deal with it. &lt;/p&gt;

&lt;p&gt;Now a query on the new &lt;code&gt;authors/autocomplete/author=r l&lt;/code&gt; will look something like this. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--smiyzhoQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rqzg9t6wb496c46xwha8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--smiyzhoQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rqzg9t6wb496c46xwha8.png" alt="Image description" width="547" height="241"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This may have looked easy, but one thing I learned the hard way was that we had to specify &lt;code&gt;settings&lt;/code&gt; and &lt;code&gt;mappings&lt;/code&gt; in the &lt;code&gt;body&lt;/code&gt; in JavaScript mode, while this wasn't needed in console mode. Hopefully this knowledge will save time for anyone else implementing autocomplete stuff in the future.&lt;/p&gt;

&lt;p&gt;Amusingly, before I got a chance to break Telescope, I also encountered Telescope seemingly breaking my WSL, during the many times of re-indexing and re-building docker images. &lt;/p&gt;

&lt;p&gt;During my local runs I like to run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;docker-compose --env-file ./config/env.development up --build (whatever images I want to build)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker-compose --env-file ./config/env.development down
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to build and stop images. &lt;br&gt;
Sometimes, my WSL trips up and returns a message such as this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Traceback (most recent call last):
  File "docker-compose", line 3, in &amp;lt;module&amp;gt;
  File "compose/cli/main.py", line 81, in main
  File "compose/cli/main.py", line 200, in perform_command  
  File "compose/cli/command.py", line 40, in project_from_options
  File "compose/config/environment.py", line 67, in from_env_file
  File "compose/config/environment.py", line 57, in _initialize
FileNotFoundError: [Errno 2] No such file or directory      
[22287] Failed to execute script docker-compose
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When this happens, my solution is to close all the existing terminals, open up WSl, and run the commands again. Doing it this way always works, so my only conclusion is that somehow my WSL got confused and messed up in between running all those commands.&lt;/p&gt;

&lt;p&gt;The next part is to try get this indexing into Parser, which surprisingly giving me some problems. Then, implementing autocomplete in the front-end. Finally, it'd be to add some tests so we can catch errors when we try to update to ES 8.0+. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>2.9 Pre - Owning ElasticSearch</title>
      <dc:creator>Roxanne Lee</dc:creator>
      <pubDate>Thu, 17 Mar 2022 01:18:29 +0000</pubDate>
      <link>https://dev.to/rclee/29-pre-owning-elasticsearch-4k44</link>
      <guid>https://dev.to/rclee/29-pre-owning-elasticsearch-4k44</guid>
      <description>&lt;p&gt;I'm Sheriff this week. During the weekend we received an email from the Prof that we were nearing the end of our term, and release 2.9 would be the last release for new features. The meeting on Tuesday was supposed to help people answer the following questions:&lt;br&gt;
    1. Which part of Telescope 3.0 do I own?&lt;br&gt;
    2. Which exsting Issues are part of this?  Which new Issues do I need to file in order to properly describe the work? When will those issues be filed?&lt;br&gt;
    3. Who can I depend on for support in development, debugging, testing, and reviews?  I can't do this alone.&lt;br&gt;
    4. What are the risks that I see, which could prevent me from getting this shipped?&lt;br&gt;
    5. How will I mitigate these risks? &lt;/p&gt;

&lt;p&gt;Since it didn't really go as planned. As Sheriff, it is only right that I write this blog as an example, so I can encourage my fellow classmates to write a blog to answer these questions as well. &lt;/p&gt;




&lt;h3&gt;
  
  
  1. Which part of Telescope 3.0 do I own?
&lt;/h3&gt;

&lt;p&gt;The Search Service. Most specifically ElasticSearch. For 2.9 I want to get some Autocomplete features in. &lt;/p&gt;

&lt;h3&gt;
  
  
  2. Which exsting Issues are part of this?  Which new Issues do I need to file in order to properly describe the work? When will those issues be filed?
&lt;/h3&gt;

&lt;p&gt;The Autocomplete will require many parts, including touching code within the legacy backend or the new Parser, the Search Service, and the front-end Search Bar. Tests will also need to be included, and the following issues will need to be involved. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Backend - &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/1417"&gt;#1417-Add author suggestions to Elasticsearch indexer backend&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Backend tests - &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/3224"&gt;#3224-Tests for the ElasticSearch Indexer in the backend and Parser&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Search Service and tests - &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/3225"&gt;#3225-Updating Search Service and tests to implement Autocomplete for Authors&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Front-end - &lt;a href="https://dev.toSearch%20bar%20update%20for%20Autocomplete%20with%20Authors"&gt;#3226&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Meta issue - &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/1260"&gt;#1260- Add autocomplete to search for Authors&lt;/a&gt;, which seemingly has some front-end support for autocomplete. &lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  3. Who can I depend on for support in development, debugging, testing, and reviews?  I can't do this alone.
&lt;/h3&gt;

&lt;p&gt;Besides the Prof, anyone who's worked on, written blogs about for, or have shown a keen interest in the Search service. Off the top of my head, but not limiting to &lt;a href="https://dev.to/amasianalbandian"&gt;Amasia&lt;/a&gt;, &lt;a href="https://dev.to/jiahuazou"&gt;Jia&lt;/a&gt;, and &lt;a href="https://github.com/manekenpix"&gt;Josue&lt;/a&gt; (alumni)&lt;/p&gt;

&lt;h3&gt;
  
  
  4. What are the risks that I see, which could prevent me from getting this shipped?
&lt;/h3&gt;

&lt;p&gt;Besides a limiting time factor, the swap from legacy backend to the Parser service could greatly complicate things. It may also take a long time for ElasticSearch indexing to work as planned. &lt;/p&gt;

&lt;h3&gt;
  
  
  5. How will I mitigate these risks?
&lt;/h3&gt;

&lt;p&gt;Keeping a close eye on the Parser service. Splitting things off in smaller issues (already done). As well as doing lots of tests and asking for reviews for the autocomplete implementation. As mentioned in my last blog, making use of the dev tools in &lt;a href="https://www.elastic.co/kibana?ultron=B-Stack-Trials-AMER-CA-Exact&amp;amp;gambit=Stack-Kibana&amp;amp;blade=adwords-s&amp;amp;hulk=paid&amp;amp;Device=c&amp;amp;thor=kibana&amp;amp;gclid=CjwKCAjwlcaRBhBYEiwAK341jRI_Ufbi4ze34P6caYgel4coWvBFk4BqzkdAjG5pJHC3EPCANASqFhoCsV4QAvD_BwE"&gt;Kibana&lt;/a&gt; could greatly help with testing indexing and search requests.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>2.8 Update - ElasticSearch Research</title>
      <dc:creator>Roxanne Lee</dc:creator>
      <pubDate>Thu, 17 Mar 2022 00:49:00 +0000</pubDate>
      <link>https://dev.to/rclee/28-update-elasticsearch-research-5dgj</link>
      <guid>https://dev.to/rclee/28-update-elasticsearch-research-5dgj</guid>
      <description>&lt;p&gt;This blog is part of blog debt, which should have been posted on Friday. &lt;/p&gt;

&lt;h2&gt;
  
  
  Release 2.8.0
&lt;/h2&gt;

&lt;p&gt;We had our 2.8 release in week 8, and it was quite a big one, including the merge of Satellite into Telescope. Furthermore, in between 2.8.0 and 2.8.1, Telescope also had its own Docker Registry set up, and we have even started using the feed-discovery image from there. &lt;/p&gt;

&lt;p&gt;For me, I didn't get much new code into 2.8. Instead, I had to do a lot of reading and experimenting on ElasticSearch indexing and autocomplete. Starting on Friday, I also managed to find some really weird bugs following the Satellite merge.&lt;/p&gt;




&lt;h2&gt;
  
  
  PNPM, Jest and Satellite.
&lt;/h2&gt;

&lt;p&gt;Let's start with the bugs first. &lt;/p&gt;

&lt;p&gt;The background was that on Friday, &lt;a href="https://www.npmjs.com/package/@elastic/elasticsearch-mock" rel="noopener noreferrer"&gt;ElasticSearch-mock&lt;/a&gt; had a 2.0.0 release that would allow its new version to work with ElasticSearch v8.0+. Based on my blog from last week, this was the main thing left that was stopping us from updating to ElasticSearch v8.0+. So I got excited and had plans for ES to be updated in Telescope by the end of the day. Motto of this story, software development is never what you expect. &lt;/p&gt;

&lt;h3&gt;
  
  
  Much too many Satellite tests
&lt;/h3&gt;

&lt;p&gt;I began with updating ES and ES-mock in the Satellite inside of Telescope. However, I quickly ran into these errors in my tests:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;TypeError: Class extends value undefined is not a constructor or null

       9 |   const client = new Client({
      10 |     node: 'http://localhost:9200',
&lt;/span&gt;&lt;span class="gp"&gt;    &amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;11 |     Connection: mock.getConnection&lt;span class="o"&gt;()&lt;/span&gt;,
&lt;span class="go"&gt;         |                      ^
&lt;/span&gt;&lt;span class="gp"&gt;      12 |   });&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="go"&gt;      13 |   // Provide a fake health check
&lt;/span&gt;&lt;span class="gp"&gt;      14 |   client.cluster.health = () =&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;Promise.resolve&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="go"&gt;
      at buildConnectionClass (node_modules/.pnpm/@elastic+elasticsearch-mock@2.0.0/node_modules/@elastic/elasticsearch-mock/index.js:121:32)
      at Mocker.getConnection (node_modules/.pnpm/@elastic+elasticsearch-mock@2.0.0/node_modules/@elastic/elasticsearch-mock/index.js:116:12)
      at new MockClient (src/satellite/src/elastic.js:11:22)
      at Elastic (src/satellite/src/elastic.js:32:14)
&lt;/span&gt;&lt;span class="gp"&gt;      at Object.&amp;lt;anonymous&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;src/satellite/test.js:999:14&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By this point I'm already too familiar with this error. This meant that the ES client and the ES-mock weren't compatible. One of them was using the older version, while the other one was using the new one. But for me, this didn't make sense since I had updated both in Satellite. So I went to my fork of Satellite, with it being its own repo, and did the same changes. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;All the tests passed.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;While this stumped me even further, I also noticed some really odd numbers occurring when I ran tests on both sides. In Telescope, the &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/3175" rel="noopener noreferrer"&gt;Satellite test suite was running more times than it should be&lt;/a&gt;. &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7z73lb3375g43o9ncnqj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7z73lb3375g43o9ncnqj.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
I filed the issue, and &lt;a href="https://github.com/Seneca-CDOT/telescope/pull/3178" rel="noopener noreferrer"&gt;Prof set up a PR&lt;/a&gt; to fix it. Only, it wasn't as quick a fix as we had thought. It lead into an afternoon of code sleuthing for me, along with the Prof (&lt;a href="https://github.com/humphd" rel="noopener noreferrer"&gt;humphd&lt;/a&gt;) and &lt;a href="https://github.com/cindyledev" rel="noopener noreferrer"&gt;cindyledev&lt;/a&gt;, one of our alumni. This all happened during a pretty hectic afternoon, as in this time, Telescope 2.8.0 was being released, and the Docker Registry was being set up. &lt;/p&gt;
&lt;h3&gt;
  
  
  Tweaking Jest Config
&lt;/h3&gt;

&lt;p&gt;Once that PR was merged, I still hadn't solved my mystery of failing Satellite tests. After quite a long while of pouring into the &lt;a href="https://jestjs.io/docs/configuration" rel="noopener noreferrer"&gt;Jest Config Documentation&lt;/a&gt;, I believed I had found the culprit, &lt;a href="https://jestjs.io/docs/configuration#moduledirectories-arraystring" rel="noopener noreferrer"&gt;moduleDirectories&lt;/a&gt;, and added this line in the Satellite jest config.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;moduleDirectories&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;&amp;lt;rootDir&amp;gt;/src/satellite/node_modules&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;node_modules&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From what I gather, it meant jest will look at the Satellite &lt;code&gt;node_modules&lt;/code&gt; to find the dependencies it needs first, and if it doesn't find them, it'll look into the root &lt;code&gt;node_modules&lt;/code&gt;. &lt;/p&gt;

&lt;h3&gt;
  
  
  PNPM and breaking the Search Service
&lt;/h3&gt;

&lt;p&gt;I was ecstatic to get the Satellite tests working, only to find in horror that my Search tests were now failing. &lt;/p&gt;

&lt;p&gt;I would encourage you, the reader, to read the comments in &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/3191" rel="noopener noreferrer"&gt;the issue&lt;/a&gt; and &lt;a href="https://github.com/Seneca-CDOT/telescope/pull/3187" rel="noopener noreferrer"&gt;the PR&lt;/a&gt;. I hope it is detailed enough to explain the issue involved. &lt;a href="https://github.com/manekenpix" rel="noopener noreferrer"&gt;Josue&lt;/a&gt; (alumni) and I tried to tackle this way into the late night, but to no avail. &lt;/p&gt;

&lt;p&gt;A "simple" summary of this issue is that something is up with PNPM and its making it that our Services are using the local Satellite instead of the Satellite package they're supposed to. It broke Search because now, Search wants to use the updated ES inside of the local Satellite. &lt;/p&gt;

&lt;h3&gt;
  
  
  Learning to run the Search Service locally
&lt;/h3&gt;

&lt;p&gt;In between this frustration and headache, I learned how to test the Search service locally. Not with building a docker image, but really locally. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Inside of the Search service, download &lt;code&gt;env-cmd&lt;/code&gt; as a dev dependency. &lt;/li&gt;
&lt;li&gt;Still in the Search service, create a script
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;dev&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;env-cmd -f env.local nodemon src/server.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;In the Search service, create a &lt;code&gt;env.local&lt;/code&gt; with the following:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;ELASTIC_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//localhost&lt;/span&gt;
&lt;span class="nx"&gt;ELASTIC_PORT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;9200&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Run &lt;code&gt;pnpm install&lt;/code&gt; to get everything updated&lt;/li&gt;
&lt;li&gt;In root (WSL for windows), delete redis cache and build the other docker images
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;rm -rf redis-data
docker-compose --env-file ./config/env.development up --build redis elasticsearch posts traefik nginx planet
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Wait for all these images to be built. Then in another terminal run &lt;code&gt;pnpm start&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Wait for a bit for post data to be filled up again. Head Search, &lt;code&gt;cd src/api/search&lt;/code&gt; and run &lt;code&gt;pnpm dev&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;The Search service will be running locally on &lt;code&gt;http://localhost:4445&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ElasticSearch Autocomplete Research
&lt;/h2&gt;

&lt;p&gt;I did a series of reading, to understand ES Autocomplete. Not just limited to these below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://taranjeet.medium.com/elasticsearch-building-autocomplete-functionality-494fcf81a7cf" rel="noopener noreferrer"&gt;Elasticsearch: Building AutoComplete functionality&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.learningstuffwithankit.dev/series/auto-complete-es" rel="noopener noreferrer"&gt;Three-part series for ES Autocomplete&lt;/a&gt;. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Basically there are 3 main ways to implement autocomplete with ElasticSearch&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://www.learningstuffwithankit.dev/implementing-auto-complete-functionality-in-elasticsearch-part-i-prefix-queries" rel="noopener noreferrer"&gt;Prefix queries&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.learningstuffwithankit.dev/implementing-auto-complete-functionality-in-elasticsearch-part-ii-n-grams" rel="noopener noreferrer"&gt;Edge-n-grams or search-as-you-type&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.learningstuffwithankit.dev/implementing-auto-complete-functionality-in-elasticsearch-part-iii-completion-suggester" rel="noopener noreferrer"&gt;Completion Suggestor&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Prefix queries are ruled out cause they run during search query time and are slow. Completion suggestors don't seem to work with multiple queries (in our case, advanced search), so that is ruled out as well. &lt;/p&gt;

&lt;h3&gt;
  
  
  Kibana
&lt;/h3&gt;

&lt;p&gt;I soon realized that it was kind of painful to change the ElasticSearch indexing in the backend, and testing out those queries with the Search service. Perhaps I wasn't doing things right, but each time I did any changes in the Backend or Search, I'd have to rebuild the Docker Images over and over again. My potato of a laptop did not like it. Sometimes the errors returned aren't even helpful at all, and I get errors with only the message &lt;code&gt;ResponseError: ElasticSearch Error&lt;/code&gt; but no context. &lt;/p&gt;

&lt;p&gt;After a long while I finally caved and created an account with &lt;a href="https://www.elastic.co/kibana?ultron=B-Stack-Trials-AMER-CA-Exact&amp;amp;gambit=Stack-Kibana&amp;amp;blade=adwords-s&amp;amp;hulk=paid&amp;amp;Device=c&amp;amp;thor=kibana&amp;amp;gclid=CjwKCAjwlcaRBhBYEiwAK341jal1tTBT9aflC1iOKikk60AvBJuY8rFYrHgPmoHexnmS4IsAP73DvBoCy6IQAvD_BwE" rel="noopener noreferrer"&gt;Kibana&lt;/a&gt;, which is advertised as a free interface to navigate the Elastic Stack cloud. &lt;/p&gt;

&lt;p&gt;For me, I was looking to use the console in "dev tools". &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8gwitthn10lhal651z0y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8gwitthn10lhal651z0y.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Now, I can more easily send requests and test the correct indexing and search queries. After that, hopefully, all it will take is to translate these console commands into JavaScript.&lt;/p&gt;




&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;In all honesty, it was a frustrating weekend for me. There was a very coincidental timing of all sorts, that ES-mock had to be updated on a Friday, and just after Satellite was merged into Telescope. I think my morale had been hit a bit, cause I still believe that if it hadn't been for the merge, I would've had ElasticSearch updated to 8.1.0 in all of Telescope by now. The merge had exposed a lot of bugs that I currently don't fully understand and don't really know how to tackle. All in all, a part of the fun and frustrations of software development. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Week 7 - 2.8.0 Pre</title>
      <dc:creator>Roxanne Lee</dc:creator>
      <pubDate>Sat, 26 Feb 2022 03:31:15 +0000</pubDate>
      <link>https://dev.to/rclee/week-7-280-pre-2ik2</link>
      <guid>https://dev.to/rclee/week-7-280-pre-2ik2</guid>
      <description>&lt;p&gt;Week 7 for me is a mid-term week as well as a pre-release week, so this blog probably won't be as long. &lt;/p&gt;




&lt;h2&gt;
  
  
  Dealing with ES Errors for &lt;code&gt;createError&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;My &lt;a href="https://github.com/Seneca-CDOT/satellite/pull/64"&gt;PR last week on Satellite&lt;/a&gt;, for refactoring our exported &lt;code&gt;createError&lt;/code&gt; to deal with ElasticSearch errors, was merged this week. Of course, it was only after a few reviews and fix ups. I'm continuing to relearn small things like remembering to name files in lower case, because not all filesystems are case sensitive. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--u04h0ejS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vua2iny1vw7hrjw0fled.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--u04h0ejS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vua2iny1vw7hrjw0fled.png" alt="Image description" width="880" height="151"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Update to ElasticSearch 8.0?
&lt;/h2&gt;

&lt;p&gt;This week, I &lt;a href="https://github.com/Seneca-CDOT/telescope/pull/3026"&gt;tried to see what would've happened&lt;/a&gt; if we updated to ES 8.0. I hadn't initially planned to tackle this so soon, mostly cause I had mid-terms and originally, the possible Docker-related problems made this issue less appealing. But I was lucky that &lt;a href="https://github.com/manekenpix"&gt;Josue&lt;/a&gt;, one of our alumni, poked me on Slack about it. Through his help, I was able to get Telescope running in dev mode with ES 8.0. Unfortunately, even though ES 8.0 seemed like it worked fine, ElasticSearch-Mock &lt;a href="https://github.com/elastic/elasticsearch-js-mock/issues/22"&gt;doesn't support ES 8.0&lt;/a&gt; yet. If we updated now, we'd have to rip out the tests that took us weeks to get in, and we'd be moving forward without tests for a while. &lt;/p&gt;




&lt;h2&gt;
  
  
  Getting Satellite Updates Semi-automatically
&lt;/h2&gt;

&lt;p&gt;I've already mentioned this issue last week. This week, I managed to get a hold of &lt;a href="https://dev.to/dukemanh"&gt;Duke&lt;/a&gt;, our resident &lt;a href="https://github.com/renovatebot/renovate"&gt;Renovate bot&lt;/a&gt; guru (just, one of the many titles that he has). He directed me to a &lt;a href="https://docs.renovatebot.com/configuration-options/#rangestrategy"&gt;possible solution&lt;/a&gt;, by changing to &lt;code&gt;rangeStrategy="bump"&lt;/code&gt; for Satellite in the bot's configs. &lt;a href="https://github.com/Seneca-CDOT/telescope/pull/3050"&gt;The PR&lt;/a&gt; was a quick fix, and has been merged. Hopefully, next time Satellite has an update, Renovate will be able to detect it, and we can just get the bot to create an update PR, instead of running the code ourselves. &lt;/p&gt;




&lt;h2&gt;
  
  
  Parser Tests
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://dev.to/tuenguyen2911_67"&gt;Tue&lt;/a&gt; had gotten his Parser service PR merged, and is now writing tests on it. I figured I'd try help out since ElasticSearch is used in this service. I've created a PR to his PR, with replacing some (actually only one) of the tests with using ES-mock. But, the Parser service is huge, with many tests involved. So, currently this is an ongoing project. &lt;/p&gt;




&lt;h2&gt;
  
  
  The agenda for next week
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SoK_VaLI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/euk1obkmy14qp7kwfgou.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SoK_VaLI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/euk1obkmy14qp7kwfgou.png" alt="Image description" width="880" height="567"&gt;&lt;/a&gt;&lt;br&gt;
These are the open issues currently assigned to me. It might look like a lot, but I'm sure its not as daunting as it seems. Some of the issues I've already mentioned above; Some, I won't be working alone, and would have help while learning to tackle it; Some, I'm not sure if I can proceed just quite yet. &lt;/p&gt;

&lt;p&gt;Overall, next week would be interesting, but, my priority would be getting the autocomplete in. It is an issue that has surprisingly been open for two years, so hopefully, it can get closed soon.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;It was not exactly an OSD focused week for me, but I'm glad I got some coding in. Hopefully next week will be very fruitful. &lt;/p&gt;

&lt;p&gt;On a final note, my HacktoberFest t-shirt (and many stickers) has finally arrived, yay! I wasn't blogging on dev.to back then, and I realized I missed the date to claim the badge on dev.to. Oh well, I'm happy the shirt arrived at least. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--p1rQPKZG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1vvdfoka5tqxdrl07dva.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--p1rQPKZG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1vvdfoka5tqxdrl07dva.png" alt="Image description" width="880" height="880"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Release 2.7.0</title>
      <dc:creator>Roxanne Lee</dc:creator>
      <pubDate>Sat, 19 Feb 2022 08:04:06 +0000</pubDate>
      <link>https://dev.to/rclee/release-270-1k9g</link>
      <guid>https://dev.to/rclee/release-270-1k9g</guid>
      <description>&lt;p&gt;I never planned for these late night posts, yet, it seems to becoming a trend. It's always on Friday nights when something pops up that I just want to get over with before I start enjoying the weekend and pretend Telescope doesn't exist. But really though, we all know students don't have real weekends.&lt;/p&gt;

&lt;p&gt;So, to ensure this doesn't turn from a late night post to an extremely early morning blog, I better get started. &lt;/p&gt;




&lt;h2&gt;
  
  
  Release 2.7
&lt;/h2&gt;

&lt;p&gt;This week was release week and we're now on &lt;a href="https://github.com/Seneca-CDOT/telescope/releases/tag/2.7.0"&gt;2.7.0&lt;/a&gt;! This release was really busy with &lt;a href="https://github.com/Seneca-CDOT/telescope/milestone/13?closed=1"&gt;over 80&lt;/a&gt; issues and PRs that were addressed. Prof has a &lt;a href="https://blog.humphd.org/shipping-2-7-0/"&gt;blog post&lt;/a&gt; on this with more detail.&lt;/p&gt;

&lt;p&gt;At the time of this post, I think there's a scheduled 2.7.1 release some time during the weekend. To sum it up, something broke, its now fixed, just waiting for a mini release. &lt;/p&gt;

&lt;p&gt;I managed to sneak into the later parts of the initial release meeting to see the Prof, our Sheriffs (&lt;a href="https://dev.to/tuenguyen2911_67"&gt;Tue&lt;/a&gt; and &lt;a href="https://dev.to/menghif"&gt;Francesco&lt;/a&gt;), and some other classmates knocking their heads to get things working again. The causes and fixes are out of my league, but maybe they will be revealed in the blog posts on &lt;a href="https://telescope.cdot.systems/"&gt;Telescope&lt;/a&gt;.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;code&gt;pnpm&lt;/code&gt; Problems
&lt;/h3&gt;

&lt;p&gt;All throughout the meeting, I had my fingers crossed that I didn't cause any of the breaks. Which, shouldn't even be a concern cause I didn't do all that much this release. I had my &lt;a href="https://github.com/Seneca-CDOT/telescope/pull/2892"&gt;advanced search tests&lt;/a&gt; merged, so yay! But, they were stalled mostly because of issues with getting the right &lt;a href="https://github.com/Seneca-CDOT/satellite"&gt;Satellite&lt;/a&gt; version. &lt;/p&gt;

&lt;p&gt;Somehow running &lt;code&gt;pnpm install&lt;/code&gt; &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/2934"&gt;wouldn't update Satellite to its latest version&lt;/a&gt;. I had thought the solution was to change the version to &lt;code&gt;"latest"&lt;/code&gt; in &lt;code&gt;package.json&lt;/code&gt;, and even &lt;a href="https://github.com/Seneca-CDOT/telescope/pull/2956"&gt;closed the issue with a PR&lt;/a&gt;, thinking that was the right fix. But nope, it was just an illusion. Before I even got to researching how to &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/2959"&gt;automatically get Satellite updates&lt;/a&gt;, the problem showed up again. &lt;/p&gt;

&lt;p&gt;It seems that the &lt;code&gt;pnpm-lock.yaml&lt;/code&gt; won't update if nothing in the &lt;code&gt;package.json&lt;/code&gt; was changed. Currently, the fix is to manually update with &lt;code&gt;pnpm update -r --latest @senecacdot/satellite&lt;/code&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Coming up next
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JAyAB8Zm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/58tqah0lawwdljfjfyxd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JAyAB8Zm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/58tqah0lawwdljfjfyxd.png" alt="Image description" width="880" height="439"&gt;&lt;/a&gt;&lt;br&gt;
Here are some of the issues that I'm currently assigned to.&lt;/p&gt;


&lt;h3&gt;
  
  
  Documentation
&lt;/h3&gt;

&lt;p&gt;One for &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/2955"&gt;Auth docs&lt;/a&gt;, because I joined the meeting on Supabase to get an idea of what it's about. Originally I had figured I needed to know &lt;a href="https://supabase.com/"&gt;Supabase&lt;/a&gt; since it might eventually take over ElasticSearch in Telescope. But it actually seems to be really neat and I'm still getting to know it and exploring the possibility of using it in my personal project.&lt;/p&gt;

&lt;p&gt;Another one for &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/2962"&gt;translating the About page&lt;/a&gt;. During our triage meeting we were exploring the possibility of translations. I think if eventually set up correctly, it might create some easy good-first-issues to attract future contributors. &lt;/p&gt;


&lt;h3&gt;
  
  
  &lt;code&gt;pnpm&lt;/code&gt; and maybe CI
&lt;/h3&gt;

&lt;p&gt;As mentioned above, currently, to get the latest Satellite version, we do things manually. The issue is to explore the possibility of &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/2959"&gt;doing it automatically&lt;/a&gt;. I am not too sure if this is possible, since any &lt;code&gt;pnpm-lock.yaml&lt;/code&gt; change requires merging a commit. So, maybe we can do it semi-automatically, kind of how &lt;a href="https://github.com/renovatebot/renovate"&gt;renovate&lt;/a&gt; does it for the other dependencies. I'll have to explore more on this and also discuss if this is still needed. &lt;/p&gt;


&lt;h3&gt;
  
  
  Docker
&lt;/h3&gt;

&lt;p&gt;I kept myself on the team for &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/2801"&gt;creating our own Docker registry&lt;/a&gt;. I am still catching up to the cloud computing classes, but since I made all that effort to "sneak" in, I might as well find a place to get handsy with it. &lt;/p&gt;


&lt;h2&gt;
  
  
  More ElasticSearch
&lt;/h2&gt;

&lt;p&gt;This comes in three parts, &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/2755"&gt;fixing a bug&lt;/a&gt;, &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/2913"&gt;refactoring and updating to ES 8.0&lt;/a&gt;, &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/1417"&gt;getting in some Autocomplete&lt;/a&gt;.&lt;/p&gt;


&lt;h3&gt;
  
  
  Part 1: Dealing with ElasticSearch errors
&lt;/h3&gt;

&lt;p&gt;This late night post is a result of working on &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/2755"&gt;the Satellite related issue&lt;/a&gt;. Though, I want to emphasize how nice it is to have tests so I sort of know what to look for. &lt;/p&gt;

&lt;p&gt;It started with Prof running into a crash related with our Search code. Here's where the crash happened when we try to &lt;code&gt;createError&lt;/code&gt; (from &lt;a href="https://npm.io/package/http-errors"&gt;http-errors&lt;/a&gt;)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// query.js&lt;/span&gt;
&lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;validateQuery&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;page&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;perPage&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;query&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;page&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;perPage&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;query error&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;createError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;503&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;   &lt;span class="c1"&gt;// &amp;lt;-- crash is here&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It could've been our problem, ElasticSearch's, or http-errors'. I'll give the conclusion here, so you could skip the next parts if it is too lengthy. "&lt;strong&gt;&lt;em&gt;ElasticSearch&lt;/em&gt;&lt;/strong&gt;" has their own custom errors that couldn't be recognized by "&lt;strong&gt;&lt;em&gt;http-errors&lt;/em&gt;&lt;/strong&gt;", which we tried to pass in as a regular &lt;code&gt;Error&lt;/code&gt; in "&lt;strong&gt;&lt;em&gt;our&lt;/em&gt;&lt;/strong&gt;" code. I'd say, it's probably mostly our fault for not having tests to catch it sooner. &lt;/p&gt;

&lt;p&gt;I figured it out thanks to my own tests that I landed.&lt;/p&gt;

&lt;p&gt;I did what Prof had suggested, and added a test in Satellite with &lt;code&gt;Error&lt;/code&gt; objects. It passed, so I was a bit more confident that it was our fault, the way I assumed and written &lt;a href="https://dev.to/rclee/270-pre-2k5n"&gt;last week&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;The fact that Search seemingly wasn't handling errors correctly was still bothering me. Therefore, I tried to refactor our Search code to handle errors, and also wrote tests to check the results. But, the error was still occurring. Eventually, it gave me the idea to add tests with ElasticSearch errors, and &lt;a href="https://github.com/Seneca-CDOT/satellite/pull/63"&gt;the tests results confirmed&lt;/a&gt; it was indeed related to ElasticSearch's fancy errors.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;should fail when directly creating Error from ElasticSearch error object&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// { errors } is imported from ElasticSearch&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;elasticError&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ResponseError&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;testing ElasticSearch Error&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="na"&gt;statusCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;404&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;createError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;503&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;elasticError&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt; &lt;span class="k"&gt;instanceof&lt;/span&gt; &lt;span class="nx"&gt;TypeError&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;toBe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;toBe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Cannot set property statusCode of [object Object] which has only a getter&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
      &lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The cause might be from &lt;a href="https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/breaking-changes.html"&gt;ElasticSearch's change with errors in 7.16&lt;/a&gt;. It was also probably not noticed much because we don't get that many errors from ElasticSearch? &lt;/p&gt;

&lt;p&gt;Anyways. As a follow up, Prof asked to explore the possibility of handling this internally within Satellite, since we export &lt;code&gt;createError&lt;/code&gt; from there. &lt;/p&gt;

&lt;p&gt;I was initially worried about &lt;code&gt;createError&lt;/code&gt; being immutable from being imported, and that we might have to change the function name. Luckily, Prof came to the rescue. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---zAvnEel--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a3a30t2fmh1gcqqzgg2t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---zAvnEel--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a3a30t2fmh1gcqqzgg2t.png" alt="Image description" width="880" height="220"&gt;&lt;/a&gt;&lt;br&gt;
 I am so glad I am still at school so I can still ask questions like this that make me seem dumb. But I'm really glad I know this trick now. &lt;/p&gt;

&lt;p&gt;Following Prof's tip, I have made a PR to &lt;a href="https://github.com/Seneca-CDOT/satellite/pull/64"&gt;take care of the ElasticSearch issue internally&lt;/a&gt;. It might have been a bad time now that I think of it, since its the weekend and Renovate is going to try to make many dependency update PRs. Nonetheless, I hope for my PR, after reviews and tweaks, will be able to fix the issue. &lt;/p&gt;




&lt;h3&gt;
  
  
  Part 2: Updating to ES 8.0
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/Seneca-CDOT/telescope/issues/2913"&gt;Rumor has it&lt;/a&gt; that every time we update ElasticSearch, Telescope breaks. I've been reading the &lt;a href="https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/8.0/changelog-client.html"&gt;release notes&lt;/a&gt;, and I've already came up with a list of features that would possibly break our code. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/8.0/changelog-client.html#_drop_callback_style_api"&gt;Dropping callback API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/8.0/changelog-client.html#_remove_the_body_key_from_the_request"&gt;Removing body key from request&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/8.0/changelog-client.html#_the_returned_value_of_api_calls_is_the_body_and_not_the_http_related_keys"&gt;The returned value of API calls is the body and not the http related keys&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some other things to note in the &lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/8.0/release-notes-8.0.0.html"&gt;API changes&lt;/a&gt; (will have to scroll down all the way to &lt;code&gt;Search&lt;/code&gt; for the whole list). &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fix range query on date fields for number inputs &lt;a href="https://github.com/elastic/elasticsearch/pull/63692"&gt;#63692&lt;/a&gt; (issue: &lt;a href="https://github.com/elastic/elasticsearch/issues/63680"&gt;#63680&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Remove type query &lt;a href="https://github.com/elastic/elasticsearch/pull/47207"&gt;#47207&lt;/a&gt; (issue: &lt;a href="https://github.com/elastic/elasticsearch/issues/41059"&gt;#41059&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Part 3: Autocomplete
&lt;/h3&gt;

&lt;p&gt;I've been trying to read more on ElasticSearch, and I realized that our Search only uses a teeny tip of what ES has to offer. I also found, to my surprise, &lt;a href="https://www.elastic.co/customers/github"&gt;that even GitHub uses ElasticSearch&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Up till now, I've mostly been debugging, so I'm hoping I can actually get some more ES features in before Supabase takes over. Autocomplete could be a nice place to start out.&lt;/p&gt;

&lt;p&gt;I think we might need the &lt;a href="https://github.com/Seneca-CDOT/telescope/pull/2846"&gt;Parser service&lt;/a&gt; in first so I can get the indexes in. I still need to get reviews in for that. Also, before I can tackle getting in new features, we have to get parts 1 and 2 completed. Furthermore, if I had understood correctly, &lt;a href="https://dev.to/amasianalbandian"&gt;Amasia&lt;/a&gt;, who's been working on the search bar redesign, has also changed some of the Search code, and might have a PR up soon as well. &lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;At this point of writing, when it might actually be categorized as an early morning post, my head is just thinking, "Oh gosh, there's so much to do", and yelling at me to sleep. But I know really, that I'm enjoying the work that I've done, and might still get to do for this course. &lt;/p&gt;

&lt;p&gt;On a side note. Just last night I had thought maybe my Hacktoberfest T-shirt is forever lost in the abyss. Just checking now though, it finally has updates. So, maybe there's still hope.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--E3lYf6rg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/07y6xhwitjs679nrttir.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--E3lYf6rg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/07y6xhwitjs679nrttir.png" alt="Image description" width="880" height="382"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>2.7.0 Pre</title>
      <dc:creator>Roxanne Lee</dc:creator>
      <pubDate>Sat, 12 Feb 2022 06:10:24 +0000</pubDate>
      <link>https://dev.to/rclee/270-pre-2k5n</link>
      <guid>https://dev.to/rclee/270-pre-2k5n</guid>
      <description>&lt;p&gt;Week 5, not a release week, but I was still quite busy. I must've cursed myself when I was worried about things picking up for other courses last week. And they sure did! I didn't get to spend as much time as I'd hope for OSD700. &lt;/p&gt;

&lt;p&gt;However, on a note that's slightly related to OSD. In one of my other classes they want us to work on our project in GitHub, with issues, PRs, and milestones all established and set up. Thing is,  even though everything seems second nature to me now, no one else in my group knew how to do those things. I basically had to do mini OSD600 lessons throughout the week, while tossing Prof's videos at my teammates and hoping that they will watch them. Conclusion is, take OSD if you can. It is so worth it. &lt;/p&gt;

&lt;p&gt;Moving on to actual OSD700 related things.&lt;/p&gt;

&lt;h2&gt;
  
  
  Search Tests!
&lt;/h2&gt;

&lt;p&gt;There's finally been progress on tests for advanced search! I have &lt;a href="https://github.com/Seneca-CDOT/telescope/pull/2892" rel="noopener noreferrer"&gt;a PR up&lt;/a&gt; and waiting for tweaks and reviews. I think I'm just happy that &lt;a href="https://github.com/elastic/elasticsearch-js-mock" rel="noopener noreferrer"&gt;ElasticSearch-Mock&lt;/a&gt; is cooperating with me. &lt;/p&gt;

&lt;p&gt;I am not totally sure why the mocks weren't clearing for me last week. I changed up how I did the tests a bit, but I think it was related to me trying to play around with both specific paths and the &lt;strong&gt;&lt;code&gt;*&lt;/code&gt;&lt;/strong&gt; for paths. It seems that probably the &lt;strong&gt;&lt;code&gt;*&lt;/code&gt;&lt;/strong&gt; path is just too generic and that maybe it caused the mocked client to not be able to find the correct mock. So not really the fault of&lt;code&gt;mock.clearAll()&lt;/code&gt;, but just me not knowing how to use it well enough. &lt;/p&gt;

&lt;h2&gt;
  
  
  Other Issues
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feb1qiqs35k3rwjz8vama.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feb1qiqs35k3rwjz8vama.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'm looking at the other issues that are assigned to me. First thing is that I wasn't aware I was assigned to doing React Native Documentation. Probably cause I had mentioned trying it out in the first week, then quickly scratched it off my priorities in the second week. But, its just documentation, might be fun to take a look at.   &lt;/p&gt;




&lt;p&gt;After finishing up the tests for advanced search today, I have a feeling the &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/2755" rel="noopener noreferrer"&gt;issue on the Satellite test&lt;/a&gt; is on us. Last week I had mentioned I had encountered the &lt;code&gt;404 Mock Not Found&lt;/code&gt; error many times when I was trying to do mocks. However I was only able to do detect those errors after I modified the &lt;code&gt;search.js&lt;/code&gt; locally with error tracking for the &lt;code&gt;client.search()&lt;/code&gt; function. My code was modified from this example below from the &lt;a href="https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reference" rel="noopener noreferrer"&gt;documents&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// callback API&lt;/span&gt;
&lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;index&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;my-index&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;from&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bar&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;ignore&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;404&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="na"&gt;maxRetries&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even though I managed to log and find the error this way, tests for search was still basically stuck because it didn't seem like it knew what to do with the errors. Probably, we just need a way to handle errors from the &lt;code&gt;client.search()&lt;/code&gt; function.&lt;/p&gt;

&lt;p&gt;However, I'll still try to add the test in for Satellite. Just to be safe. The more tests the merrier? &lt;/p&gt;




&lt;h2&gt;
  
  
  Docker Issues
&lt;/h2&gt;

&lt;p&gt;Compared to a lot of people in this class, I am very slow at getting to learning Docker. However, this week I had managed to sneak (ask to get added) into Prof's other lectures on Docker, and just the first class had cleared up some of my personal confusions. &lt;/p&gt;

&lt;p&gt;As for these two Docker related issues &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/2835" rel="noopener noreferrer"&gt;"Improve size of web Dockerfile"&lt;/a&gt;, &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/2801" rel="noopener noreferrer"&gt;Make Telescope project usable by a Docker Registry&lt;/a&gt;. I admit I am still mostly dumbfounded by it all even though there has been a lot of discussion. Hopefully by catching up with the lectures and doing a bit more research, I'll know more how to approach them.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;I am glad I stuck around in OSD. My teammates from the group I mentioned earlier had been asking me where I knew all this stuff with Git and GitHub, and I've told them that it was all OSD. Then we'd laugh and try not to think about what would've happened if none of us knew how to use Git and GitHub. &lt;/p&gt;

&lt;p&gt;I'm also quite excited in the possibility of getting to move on from ElasticSearch, and starting to learn something new (Docker). While I don't need to worry about labs and assignments for the class that I had snuck into, I'm going to count it as part of the time I'm dedicating to researching for OSD700 and I'm definitely looking forward to future lectures, and catching up on the recordings.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Release 2.6.0</title>
      <dc:creator>Roxanne Lee</dc:creator>
      <pubDate>Sat, 05 Feb 2022 04:53:29 +0000</pubDate>
      <link>https://dev.to/rclee/release-260-47ge</link>
      <guid>https://dev.to/rclee/release-260-47ge</guid>
      <description>&lt;p&gt;In this week for OSD700, we had our &lt;a href="https://github.com/Seneca-CDOT/telescope/releases/tag/2.6.0"&gt;2.6.0 release&lt;/a&gt; for Telescope. As what seems to becoming a pattern for all release weeks, many PRs are getting merged, and things are moving quickly. There was a lot of new things popping up, like Turborepo and Supabase, and I wish I had some time to get to know them better. &lt;/p&gt;

&lt;p&gt;For me, my focus this week was to get to creating tests for Search, specifically advanced search. Unfortunately, it didn't go as smoothly as I had hoped for. But, there was progress, and &lt;a href="https://www.elastic.co/blog/smooth-mocking-with-the-elasticsearch-node-js-client"&gt;ElasticSearch-mock&lt;/a&gt; and I seem to be gradually getting along. &lt;/p&gt;




&lt;h2&gt;
  
  
  ElasticSearch Mock
&lt;/h2&gt;

&lt;p&gt;If there was a type of friend that ElasticSearch Mock (ES Mock) would be, it'd probably be one of those that you seem to know them, but actually don't. They're picky and stubborn, and like to give you surprises and tease you to no end. This about sums up the relationship I've had with ES Mock this week. Every time I thought I might've have had a breakthrough and could move on, it seems to drag me back while yelling, "No! Play with me more!", and then comes up with more hurdles that I'll need to jump through. &lt;/p&gt;




&lt;h3&gt;
  
  
  Getting ES Mock exported from Satellite
&lt;/h3&gt;

&lt;p&gt;"But, Roxanne" you say, "The article says clearly, &lt;em&gt;Smooth mocking&lt;/em&gt;." &lt;/p&gt;

&lt;p&gt;Under normal circumstances, it might be smooth. ES mock is a library provided by &lt;a href="https://www.elastic.co/"&gt;Elastic.co&lt;/a&gt;, who are the ones that created the regular ElasticSearch. How I understand that they have it set up is that during mocking, a mocked API would establish a connection that an ES client could connect to instead of using the regular connection.&lt;/p&gt;

&lt;p&gt;Except Telescope is a little special. Thanks to &lt;a href="https://github.com/Seneca-CDOT/telescope/pull/2753"&gt;my PR last week&lt;/a&gt;, Telescope doesn't use ElasticSearch directly anymore, and instead uses a client packaged inside of &lt;a href="https://github.com/Seneca-CDOT/satellite"&gt;Satellite&lt;/a&gt;. So, in order to get this special client mocked in our tests, Satellite will also need give us access to its mock. &lt;/p&gt;

&lt;p&gt;There were a lot of experiments, a couple versions, and many tweaks. In between I realized just how picky and strict ES mock could get with the APIs. Here is an example from the ES Mock &lt;a href="https://www.npmjs.com/package/@elastic/elasticsearch-mock"&gt;npm registry README&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;mock&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;GET&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/_cat/health&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="na"&gt;querystring&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;pretty&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;true&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ok&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;health&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// =&amp;gt; 404 error&lt;/span&gt;
&lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;health&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;pretty&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// =&amp;gt; { status: 'ok' }&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Basically, the more field that are specified, the stricter the mock gets. There are some fields that if they exist in the API, you had to specify in the query, and vice versa, otherwise, ES Mock would just think the right mock doesn't exist, and return a 404 &lt;code&gt;Mock not Found&lt;/code&gt; error. &lt;/p&gt;




&lt;p&gt;At last, &lt;a href="https://github.com/Seneca-CDOT/satellite/commit/a254e330175c2dfde27d8de31884332c70dbd18f"&gt;a final version&lt;/a&gt; was merged into Satellite. Prof helped a lot with this final version, and it was fascinating to see him code. There was a few coding tricks that I wasn't aware of. Especially the &lt;a href="https://github.com/Seneca-CDOT/satellite/blob/0405efc51264a861a001c26ffa55d8fb4a1dfbac/src/elastic.js#L33"&gt;line&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mock&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;mock&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we could not only get a client instance, we can also get a mock object &lt;code&gt;{ mock }&lt;/code&gt; as well. I'm just fascinated cause I think the original way I had it in my head wouldn't be as condensed. &lt;/p&gt;




&lt;h3&gt;
  
  
  ES Mock Strikes Again
&lt;/h3&gt;

&lt;p&gt;Finally, with the changes in Satellite released, and updated in the Search service, it seemed that maybe, just maybe it would be smooth sailing onward, and I could finally get to really mocking Search. But nope, this time around, the mocks weren't clearing for me and was messing with my tests. This got me a little frustrated, cause it was clearing for the tests written for Satellite. &lt;/p&gt;

&lt;p&gt;At this point, last night of writing this blog, I decided I needed a break from playing with ES Mock. It was getting to a point where, even taking a small nap, I'm dreaming of coding and just getting the &lt;strong&gt;&lt;em&gt;Mock not Found&lt;/em&gt;&lt;/strong&gt; error. A break might be working cause as I am writing this blog, I'm forming some theories that I'd like to test out to make it right. Hopefully I'll get to write about this next week. &lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;It doesn't seem like I got much accomplished this week, but I'd say I tried. I had spent a lot of time on OSD this week, and I wish I had more, or that I was smarter so my time could be more efficient. Like I mentioned, I would really like to have the time to explore more of what's going on in Telescope, and branch off and maybe do reviews in other areas. &lt;/p&gt;

&lt;p&gt;It's lucky that most of the meetings during off hours are recorded (a little sad about the lost Supabase meeting), and that there's lots of information in the weekly blogs to read about (Supabase meeting blog please? *Wink *Wink).&lt;/p&gt;

&lt;p&gt;I'm also lucky that, since its the start of the semester, my other courses are rather light. I shudder to think what would happen later on when things pick up. Regardless, OSD doesn't seem like coursework. Things are much more dynamic, and I'm pretty sure the more time that I put into it, the more I'd gain. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>2.6.0 Pre</title>
      <dc:creator>Roxanne Lee</dc:creator>
      <pubDate>Sat, 29 Jan 2022 06:49:17 +0000</pubDate>
      <link>https://dev.to/rclee/260-pre-al</link>
      <guid>https://dev.to/rclee/260-pre-al</guid>
      <description>&lt;p&gt;This blog is unfortunately going to come out a bit later than midnight. Unforeseen merge conflicts happened that didn't go as smoothly as I had hoped for (more on that later). &lt;/p&gt;

&lt;p&gt;So much has happened in week 3 for OSD700, and I had quite enjoyed it all. &lt;/p&gt;




&lt;h2&gt;
  
  
  Sheriff-lead meetings
&lt;/h2&gt;

&lt;p&gt;Our two &lt;a href="https://github.com/Seneca-CDOT/telescope/wiki/Winter-2022---Telescope-3.0#sheriff-schedule"&gt;sheriffs&lt;/a&gt; ran both in-class meetings this week, and they were both really awesome. They worked well together, pushed out quite a few releases, and showed an extensive knowledge of the goings-on in &lt;a href="https://github.com/Seneca-CDOT/telescope"&gt;Telescope&lt;/a&gt; and &lt;a href="https://github.com/Seneca-CDOT/satellite"&gt;Satellite&lt;/a&gt;. I won't be able to do it to the level that they did, so I admire them a lot for that. &lt;/p&gt;

&lt;h2&gt;
  
  
  Extracting Elasticsearch from Satellite for Search
&lt;/h2&gt;

&lt;p&gt;I had mentioned &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/2578"&gt;this issue&lt;/a&gt; last week that I had for &lt;strong&gt;release 2.6.0&lt;/strong&gt;. Instead of just for &lt;strong&gt;Search&lt;/strong&gt; it was targeted for all the microservices that used Elasticsearch. &lt;/p&gt;

&lt;p&gt;At this time last week my brain was still thinking that this issue meant using Elasticsearch on Telescope without Satellite. Which had me really confused, because it "seemed" already implemented in Telescope. Luckily, I had a quick crash course with the Prof on how to mock Elasticsearch, and had this confusion diffused. &lt;/p&gt;

&lt;p&gt;That didn't stop me from making things seem more difficult than they actually were. A lot of wasted time was spent thinking I needed to take Elasticsearch completely out of Telescope and diving into too much research on areas that wasn't even related to what the issue intended. &lt;/p&gt;

&lt;p&gt;Elasticsearch is also one of the dependencies for the &lt;code&gt;Parser&lt;/code&gt; service, but I couldn't find where it was being used since the service is still a work in progress. I reached out to Tue to get more insight on it. He also helped me out with removing dependencies in the services. Apparently, taking out the dependency in the relevant &lt;code&gt;package.json&lt;/code&gt; then running &lt;code&gt;pnpm install&lt;/code&gt; is the trick. &lt;/p&gt;

&lt;p&gt;In the end I decided to just make a &lt;a href="https://github.com/Seneca-CDOT/telescope/pull/2753"&gt;PR on just the Search service&lt;/a&gt;, and work from there. I think Tue must've worked out how they'd implement Elasticsearch for Parser with his mentors, because the issue was closed when the PR merged. &lt;/p&gt;

&lt;h2&gt;
  
  
  Getting ready for tests on Search
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/2621"&gt;issue on tests for search&lt;/a&gt; I had mentioned last week has been bumped to &lt;strong&gt;2.6.0&lt;/strong&gt; as well. The tests are blocking implementations for &lt;strong&gt;advanced search&lt;/strong&gt;, so we have to try to get things started at least. &lt;/p&gt;

&lt;p&gt;I'm working with Jia-Hua on this issue, and we came to an agreement that I'd make sure using Elasticsearch from Satellite wouldn't break Search, while he creates a &lt;a href="https://github.com/Seneca-CDOT/telescope/pull/2757"&gt;PR for the initial setup for tests&lt;/a&gt;. This PR quite amusingly led to a couple more PRs. &lt;/p&gt;

&lt;h3&gt;
  
  
  Fixing setup files for Posts tests
&lt;/h3&gt;

&lt;p&gt;In the setup for &lt;strong&gt;Search&lt;/strong&gt; tests, we used &lt;strong&gt;Posts&lt;/strong&gt; tests as a template. Prof spotted that the config files for tests correctly. According to the &lt;a href="https://jestjs.io/docs/configuration#setupfiles-array"&gt;docs&lt;/a&gt; this meant that &lt;code&gt;MOCK_REDIS&lt;/code&gt; in the &lt;strong&gt;Posts&lt;/strong&gt; test setup file shouldn't have been set to the value we wanted. I'm pretty sure there had to be better ways to debug, but &lt;code&gt;console.log&lt;/code&gt; had always been a trusty friend, and I had used it to find out we've only been tricked to thinking the tests were set up correctly. I sent up a &lt;a href="https://github.com/Seneca-CDOT/telescope/pull/2759"&gt;PR for setting it up correctly for &lt;strong&gt;Posts&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Removing cross-env dev dependency
&lt;/h3&gt;

&lt;p&gt;While working on the PR for &lt;strong&gt;Posts&lt;/strong&gt; I noticed some scripts for tests in the main &lt;code&gt;package.json&lt;/code&gt; had defined &lt;code&gt;MOCK_REDIS=1&lt;/code&gt; in their lines. I removed them, and this led to &lt;a href="https://github.com/Seneca-CDOT/telescope/pull/2771"&gt;another PR&lt;/a&gt; with the intention of removing &lt;code&gt;cross-env&lt;/code&gt;, which is needed to define these config values. &lt;/p&gt;

&lt;p&gt;This current PR is still open and is the main reason why I'm late in submitting this blog post. &lt;/p&gt;

&lt;p&gt;Removing the dependencies also involves touching the &lt;code&gt;pnpm-lock.yaml&lt;/code&gt; file. In our current master branch there are many long lines like &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5nl4rs-d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jjfjalgydu62jj2rpg50.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5nl4rs-d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jjfjalgydu62jj2rpg50.png" alt="Image description" width="880" height="20"&gt;&lt;/a&gt; which &lt;code&gt;prettier&lt;/code&gt; doesn't like and auto-commits to change to below:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--drqIfH8E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xz92mwl9hjlckqfkwt39.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--drqIfH8E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xz92mwl9hjlckqfkwt39.png" alt="Image description" width="880" height="84"&gt;&lt;/a&gt;. Trying to rebase got me a merge conflict, and sorting it out meant 8,000+ lines were changed. I had thought I had messed up until I figured out it was &lt;code&gt;prettier&lt;/code&gt; all along. &lt;/p&gt;

&lt;p&gt;This PR still needs tweaks, and maybe I did mess up on setting up &lt;code&gt;prettier&lt;/code&gt;, but I'm sure Prof will tell me what to do to fix it. &lt;/p&gt;

&lt;h3&gt;
  
  
  Moving forwards with testing
&lt;/h3&gt;

&lt;p&gt;I didn't have enough time to play around with mocking Elasticsearch just yet. Jia-hua has been kind enough to share some reading material. Doing this would be my main priority for 2.6.0.  &lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;All in all, a very eventful week. Things are moving quickly in Telescope, I'd like to try keep up with them. &lt;/p&gt;

&lt;p&gt;If I'd have re-done things this week, I would've saved time in just getting the PRs out and stop trying to overthink things. It is incredible how fast Prof responds and how knowledgeable some of the students in the class are. So, I'm sure if my PR needs tweaking they'll let me know in the reviews. &lt;/p&gt;

</description>
      <category>opensource</category>
      <category>osd700</category>
    </item>
  </channel>
</rss>
