Elasticsearch: Add char analyzer to ensure consistency of query results

When using Elasticsearch, doing a query that involved the characters "."
and "_", from full text fields, did not include results with keywords as
a substring. This behavior was different from Lucene, where these two
characters are mapped to the space character (" ") so that the query
returns keywords separated by them.

This change adds character mappings for Elasticsearch in order to ensure
that the full-text queries return same results as when using Lucene. At
index creation time, this change creates a new elasticsearch setting
where an analyzer with character mappings is configured. This analyzer
is then added to the elasticsearch mappings to be used by the full-text
field queries.

Because the elasticsearch mappings and settings can only be configured
at index creation time, one should take the following steps to apply
this change:

1. delete the index (changes, accounts, groups).
2. initialize an Elasticsearch site with this change.
3. reindex the documents (changes, accounts, groups).
4. start the site.

This change applies to all the currently supported Elasticsearch
versions.

Bug: Issue 9146
Bug: Issue 9147
Change-Id: I6da7a98d35d912b5bee7cc510d02db4433f25538
3 files changed
tree: a8059a1a3b9c35ba60f0f9df175bb88689e78bd2
  1. gerrit-acceptance-tests/
  2. gerrit-elasticsearch/
  3. gerrit-pgm/