Best naming conventions: Of similar field across different types in singular/plural plus dot notation opinions sought

There are 3 parts to this question.

Imagine we have two types, jobs and companies.
Companies can be based in several locations, a job is based in one location. For simplicity let's say we map that as keyword or array of keywords, which as far as I understand is equivalent.

So we might have this mapping for companies:

    {
  "my-idx": {
    "mappings": {
      "companies": {
        "properties": {
          "company_name": {
            "type": "text"
          },
          "description": {
            "type": "text"
          },
          "locations": {
            "type": "keyword"
          }
        }
      }
    }
  }
}

and for jobs:

{
  "my-idx": {
    "mappings": {
      "jobs": {
        "properties": {
          "job_title": {
            "type": "text"
          },
          "description": {
            "type": "text"
          },
          "location": {
            "type": "keyword"
          }
        }
      }
    }
  }
}

A company could thus be:

{
   "company_name": "Foo ltd",
   "description": "some text",        
   "locations": ["London","Sydney"],        
}

And a job:

{
   "job_title": "Developer",
   "description": "some description about job",        
   "location": "London",     
}

Now it seems to me that it would be best to name both fields 'location' in the singular knowing that both single entries and arrays are treated the same. This would be similar(-ish) to the way I got into the habit of naming Sql tables in the singular.

Could not find anything on recomended best practices on naming, what are thoughts on this? Is there anything that could be argued against it?

the fields 'description' in jobs and in companies are different and similar at the same time (same 'thing' but different purposes). would it be better to name them 'job_description' and 'company_description' or is it better to keep the same name for cross-type searching?

Finally, if different names were to be used, is it better to use undercore 'company_name' or dot (company.name')? I guess this is more a general question about the use of dots in names, it looks a bit better to me but I belive it to be used internally...?

Ideas Welcome, thanks :slight_smile:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.