# Case Sensitive query?

**URL:** <https://discuss.elastic.co/t/case-sensitive-query/116504>\
**Category:** Elasticsearch\
**Created:** [January 22, 2018, 4:03pm UTC](https://discuss.elastic.co/t/case-sensitive-query/116504 "2018-01-22T16:03:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Derrick](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/derrick/32/49944_2.png) [@Derrick](https://discuss.elastic.co/u/Derrick)\
**Post date:** [January 22, 2018, 4:03pm UTC](https://discuss.elastic.co/t/case-sensitive-query/116504/1 "2018-01-22T16:03:30Z")

</div>

Hi, I have an issue with query, I want the search case insensitive, but I don't know what's wrong with my mapping file?

the below query returns result properly.

```auto
{
  "query": {
    "bool": {
      "must": [
        {
          "wildcard": {
            "booking.cparty1": {
              "wildcard": "manitoba*",
              "boost": 1
            }
          }
        }
      ],
      "disable_coord": false,
      "adjust_pure_negative": true,
      "boost": 1
    }
  }
}

```

but the blow query returns nothing

``````````````````````auto
{
  "query": {
    "bool": {
      "must": [
        {
          "wildcard": {
            "booking.cparty1": {
              "wildcard": "MANITOBA*",
              "boost": 1
            }
          }
        }
      ],
      "disable_coord": false,
      "adjust_pure_negative": true,
      "boost": 1
    }
  }
}
``````````````````

my mapping file:
`````````````````````
{
	"state": "open",
	"settings": {
		"index": {
			"mapping": {
				"total_fields": {
					"limit": "2000"
				}
			},
			"number_of_shards": "5",
			"provided_name": "trades_dpm_slave",
			"creation_date": "1514560558202",
			"number_of_replicas": "1",
			"uuid": "6Oq5mbLzTGOaPFE05ogg_A",
			"version": {
				"created": "5060499"
			}
		}
	},
	"mappings": {
		"trade": {
			"_all": {
				"enabled": false
			},
			"properties": {
				"booking": {
					"properties": {
						"bookrunnerUpdate": {
							"type": "date"
						},
						"linkedID": {
							"type": "text",
							"fields": {
								"keyword": {
									"type": "keyword",
									"doc_values": false
								}
							}
						},
						"parent": {
							"type": "text",
							"fields": {
								"keyword": {
									"type": "keyword",
									"doc_values": false
								}
							}
						},
						"bookRunnerUpdateTime": {
							"type": "date"
						},
						"confirmationType": {
							"include_in_all": true,
							"type": "text",
							"fields": {
								"keyword": {
									"type": "keyword",
									"doc_values": false
								}
							}
						},
						"book": {
							"include_in_all": true,
							"type": "text",
							"fields": {
								"keyword": {
									"type": "keyword",
									"doc_values": false
								}
							}
						},
						"dealerIDUpdate": {
							"type": "date"
						},
						"notepad": {
							"index": false,
							"type": "text"
						},
						"bookrunner": {
							"index": false,
							"type": "text"
						},
						"bookingPurpose": {
							"index": false,
							"type": "text"
						},
						"createdOn": {
							"type": "date"
						},
						"originated": {
							"type": "text",
							"fields": {
								"keyword": {
									"type": "keyword"
								}
							}
						},
						"notionalMatch": {
							"type": "boolean"
						},
						"dealRevenue": {
							"type": "text"
						},
						"dealerUpdateTime": {
							"type": "date"
						},
						"cparty1": {
							"include_in_all": true,
							"type": "text",
							"fields": {
								"keyword": {
									"type": "keyword"
								}
							}
						},
						"notionalTrade": {
							"type": "boolean"
						},
						"cparty2": {
							"type": "text",
							"fields": {
								"keyword": {
									"type": "keyword"
								}
							}
						},
						"id": {
							"include_in_all": true,
							"fielddata": true,
							"boost": 2,
							"type": "text",
							"fields": {
								"keyword": {
									"type": "keyword"
								}
							}
						},
						"terminated": {
							"type": "text"
						},
						"ticket": {
							"include_in_all": true,
							"boost": 2,
							"type": "text",
							"fields": {
								"keyword": {
									"type": "keyword"
								}
							}
						},
						"bookingSubPurpose": {
							"type": "text"
						},
						"executedOn": {
							"type": "date"
						},
						"transProductID": {
							"include_in_all": true,
							"type": "keyword"
						},
						"inceptionCVA": {
							"type": "text"
						},
						"tradeDate": {
							"type": "date"
						},
						"dealType": {
							"include_in_all": true,
							"type": "keyword"
						},
						"version": {
							"type": "short"
						},
						"createdBy": {
							"type": "keyword"
						},
						"affirmStatus": {
							"type": "keyword"
						},
						"name": {
							"type": "text",
							"fields": {
								"keyword": {
									"type": "keyword"
								}
							}
						},
						"folderName": {
							"include_in_all": true,
							"type": "text",
							"fields": {
								"keyword": {
									"type": "keyword"
								}
							}
						},
						"marketerId": {
							"include_in_all": true,
							"type": "text",
							"fields": {
								"keyword": {
									"type": "keyword"
								}
							}
						},
						"confirmationID": {
							"include_in_all": true,
							"type": "text",
							"fields": {
								"keyword": {
									"type": "keyword"
								}
							}
						},
						"entity": {
							"type": "text",
							"fields": {
								"keyword": {
									"type": "keyword"
								}
							}
						},
						"status": {
							"include_in_all": true,
							"type": "keyword"
						}
					}
				},
				"_default_": {
					"_all": {
						"enabled": false
					}
				}
			}
		}
	}
}

``````````````````````

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 22, 2018, 4:18pm UTC](https://discuss.elastic.co/t/case-sensitive-query/116504/2 "2018-01-22T16:18:14Z")

</div>

Please format your code using `</>` icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and not the citation button. It will make your post more readable.

Or use markdown style like:

````
```
CODE
```

````

Please edit your post.

Here most likely you need to search with:

```auto
"wildcard": "manitoba*"

```

or search on `booking.cparty1.keyword` field.

---

<div class="post-metadata">

**Author:** ![Derrick](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/derrick/32/49944_2.png) [@Derrick](https://discuss.elastic.co/u/Derrick)\
**Post date:** [January 22, 2018, 4:25pm UTC](https://discuss.elastic.co/t/case-sensitive-query/116504/3 "2018-01-22T16:25:22Z")

</div>

Dadoonet,

I cannot search with

```auto
"wildcard": "MANITOBA*"

```

WHY?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 22, 2018, 4:46pm UTC](https://discuss.elastic.co/t/case-sensitive-query/116504/4 "2018-01-22T16:46:05Z")

</div>

As per [Wildcard query | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html)

> Matches documents that have fields matching a wildcard expression ( **not analyzed** ).

Read also:

> Note that **this query can be slow** , as it needs to iterate over many terms. In order to prevent **extremely slow wildcard queries** , a wildcard term should not start with one of the wildcards \* or ?.

---

<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:** [February 19, 2018, 4:46pm UTC](https://discuss.elastic.co/t/case-sensitive-query/116504/5 "2018-02-19T16:46:18Z")

</div>

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