Elasticsearch search term for exact match does not work

I use query_string to search. The search works fine, but getting all of the entries with lowercase and uppercase letters matches. But I want the exact match to be case sensitive? For example: Search field: "title" Current output:

  • title
  • Title
  • TITLE

I want only first (title). How to solve this problem.

My code in java:

QueryBuilder qbString = null;

qbString = QueryBuilders.queryString ("name") field ("field_name") ;.

+4
source share
2 answers

You need to configure the display / text processing so that the tokens are indexed without the bottom.

"" - ( -).

, , : https://www.found.no/play/gist/7464654

+2

5 + ElasticSearch , !

String , , , .

, .

SO, , .

:

PUT testindex
{
    "mappings": {
      "original": {
        "properties": {
          "@timestamp": {
            "type": "date"
          },
          "@version": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "APPLICATION": {
            "type": "text",
            "fields": {
                "exact": {"type": "keyword"}
            }
          },
          "type": {
            "type": "text",
            "fields": {
                "exact": {"type": "keyword"}
            }
          }
        }
      }
    }
  }
0

All Articles