Using Elasticsearch to query for jobs with specific skills
In this recipe, we move back to using the crawler that we created to scrape and store job listings from StackOverflow in Elasticsearch. We then extend this capability to query Elasticsearch to find job listings that contain one or more specified skills.
Getting ready
The example we will use is coded to use a local Elastic Cloud engine and not a local Elasticsearch engine. You can change that if you want. For now, we will perform this process within a single python script that is run locally and not inside a container or behind an API.
How to do it
We proceed with the recipe as follows:
- The code for the recipe is in the
11/03/search_jobs_by_skills.py
file:
from sojobs.scraping import get_job_listing_info from elasticsearch import Elasticsearch import json if __name__ == "__main__": es = Elasticsearch() job_ids = ["122517", "163854", "138222", "164641"] for job_id in job_ids: if not es.exists(index='joblistings...