# Search single character

**URL:** <https://discuss.elastic.co/t/search-single-character/319516>\
**Category:** Elasticsearch\
**Created:** [November 22, 2022, 7:23am UTC](https://discuss.elastic.co/t/search-single-character/319516 "2022-11-22T07:23:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zaid\_Raza](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zaid_raza/32/102383_2.png) [@Zaid\_Raza](https://discuss.elastic.co/u/Zaid_Raza)\
**Post date:** [November 22, 2022, 7:23am UTC](https://discuss.elastic.co/t/search-single-character/319516/1 "2022-11-22T07:23:34Z")

</div>

Hi,  
I am creating a search query in which I am searching course name. For example if I search "Introduction to R" then the output is "Introduction to Scrum". In this query "R" is not considered as a single word while searching document.  
I have attached the query for reference.

```auto
{
  "_source": [
    "meta_title",
    "meta_description",
    "general_title",
    "provider_logo"
  ],
  "query": {
    "bool": {
      "must": [
        {
          "bool": {
            "should": [
              {
                "multi_match": {
                  "type": "best_fields",
                  "fields": [
                    "meta_title",
                    "meta_description",
                    "general_title",
                    "provider_logo"
                  ],
                  "operator": "and",
                  "query": "Introduction to r",
                  "boost": 1
                }
              },
              {
                "query_string": {
                  "query": "Introduction to r",
                  "fields": [
                    "category_link",
                    "course_link"
                  ]
                }
              }
            ]
          }
        }
      ],
      "should": [
        {
          "multi_match": {
            "type": "best_fields",
            "fields": [
              "meta_title^10",
              "meta_description",
              "general_title",
              "provider_logo"
            ],
            "operator": "AND",
            "query": "Introduction to r",
            "boost": 20
          }
        },
        {
          "multi_match": {
            "type": "best_fields",
            "fields": [
              "meta_title^10",
              "meta_description",
              "general_title",
              "provider_logo"
            ],
            "operator": "OR",
            "query": "Introduction to r",
            "boost": 10
          }
        },
        {
          "query_string": {
            "query": "Introduction to r",
            "fields": [
              "category_link",
              "course_link"
            ],
            "boost": 10
          }
        }
      ]
    }
  },
  "aggs": {
    "top-providers": {
      "terms": {
        "field": "provider_name",
        "order": {
          "top_hit": "desc"
        }
      },
      "aggs": {
        "top-categories_hits": {
          "top_hits": {
            "_source": {
              "excludes": [
                "brief_html"
              ]
            }
          }
        },
         "top_hit": {
            "max": {
              "script": {
                "source": "_score"
              }
            }
          }
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 20, 2022, 7:23am UTC](https://discuss.elastic.co/t/search-single-character/319516/2 "2022-12-20T07:23:45Z")

</div>

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