# NumberFormatException for query field in simple\_query\_string

**URL:** <https://discuss.elastic.co/t/numberformatexception-for-query-field-in-simple-query-string/234602>\
**Category:** Elasticsearch\
**Created:** [May 27, 2020, 6:38pm UTC](https://discuss.elastic.co/t/numberformatexception-for-query-field-in-simple-query-string/234602 "2020-05-27T18:38:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![weilandia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/weilandia/32/55574_2.png) [@weilandia](https://discuss.elastic.co/u/weilandia)\
**Post date:** [May 27, 2020, 6:38pm UTC](https://discuss.elastic.co/t/numberformatexception-for-query-field-in-simple-query-string/234602/1 "2020-05-27T18:38:45Z")

</div>

I'm getting `NumberFormatException[For input string: \"AZURE\"]` when validating this query. This is an issue that's popped up recently using ES 7.6.2. This doesn't make sense to me since "query" is not a field with a mapping. Any ideas?

```auto
    {:query=>
      {:bool=>
        {:must=>
          {:simple_query_string=>
            {:query=>"AZURE ",
             :default_operator=>"and",
             :fields=>
              ["num^10",
               "subject^10",
               "requirements^10",
               "set_aside",
               "groups",
               "attachments",
               "agency.*",
               "sub_agency.*",
               "contract_officer.*",
               "inbound_emails.*",
               "location.*"]}},
         :filter=>
          {:bool=>
            {:must=>
              [{:bool=>
                 {:must=>
                   [{:bool=>
                      {:should=>
                        [{:term=>{:contract_vehicle_id=>6}},
                         {:term=>{:contract_vehicle_id=>1}},
                         {:term=>{:contract_vehicle_id=>9}},
                         {:term=>{:contract_vehicle_id=>3}},
                         {:term=>{:contract_vehicle_id=>5}},
                         {:term=>{:contract_vehicle_id=>4}}]}}]}},
               {:terms=>{:prime_contract_vehicle_ids=>[3, 4, 5, 6, 7, 8, 9, 10, 2]}}]}}}}}

```

I'm validating the query with the validation api like this (where search data is the query posted above):

```auto
    client.perform_request(
        "GET",
        "index_name/_validate/query",
        { explain: true },
        search_data.to_json
      )

```

Mapping:

```auto
{"mappings"=>
    {"properties"=>
      {"agency"=>
        {"properties"=>
          {"aliases"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}},
           "alt_short_name"=>
            {"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}},
           "name"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}},
           "short_name"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}}}},
       "agency_id"=>{"type"=>"long"},
       "attachments"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}},
       "awarded"=>{"type"=>"boolean"},
       "canceled"=>{"type"=>"boolean"},
       "contract_officer"=>
        {"properties"=>
          {"email"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}},
           "email_domains"=>
            {"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}},
           "email_names"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}},
           "first_name"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}},
           "last_name"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}},
           "phone_numbers"=>
            {"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}}}},
       "contract_officer_id"=>{"type"=>"long"},
       "contract_vehicle_id"=>{"type"=>"long"},
       "expires_at"=>{"type"=>"date"},
       "groups"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}},
       "inbound_emails"=>
        {"properties"=>
          {"from"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}},
           "subject"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}}}},
       "location"=>
        {"properties"=>
          {"city"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}},
           "country"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}},
           "facility"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}},
           "geo"=>{"properties"=>{"lat"=>{"type"=>"float"}, "lon"=>{"type"=>"float"}}},
           "place"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}},
           "postal_code"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}},
           "region"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}},
           "street"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}}}},
       "mod_at"=>{"type"=>"date"},
       "num"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}},
       "oem_ids"=>{"type"=>"long"},
       "or_equal"=>{"type"=>"boolean"},
       "prime_contract_vehicle_ids"=>{"type"=>"long"},
       "received_at"=>{"type"=>"date"},
       "request_type"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}},
       "requirements"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}},
       "set_aside"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}},
       "sub_agency"=>
        {"properties"=>
          {"aliases"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}},
           "alt_short_name"=>
            {"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}},
           "name"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}},
           "short_name"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}}}},
       "sub_agency_id"=>{"type"=>"long"},
       "subject"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}},
       "viewed_by"=>{"type"=>"long"},
       "workspaces"=>
        {"properties"=>
          {"assigned"=>{"type"=>"long"},
           "disinterested"=>{"type"=>"long"},
           "following"=>{"type"=>"long"},
           "qualifying"=>{"type"=>"long"},
           "quoted"=>{"type"=>"long"},
           "submitted"=>{"type"=>"long"}}}}}}}

```

---

<div class="post-metadata">

**Author:** ![weilandia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/weilandia/32/55574_2.png) [@weilandia](https://discuss.elastic.co/u/weilandia)\
**Post date:** [May 27, 2020, 6:51pm UTC](https://discuss.elastic.co/t/numberformatexception-for-query-field-in-simple-query-string/234602/3 "2020-05-27T18:51:44Z")

</div>

Works as expected (query is valid) in 7.6.0

---

<div class="post-metadata">

**Author:** ![weilandia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/weilandia/32/55574_2.png) [@weilandia](https://discuss.elastic.co/u/weilandia)\
**Post date:** [May 27, 2020, 7:01pm UTC](https://discuss.elastic.co/t/numberformatexception-for-query-field-in-simple-query-string/234602/4 "2020-05-27T19:01:23Z")

</div>

Something was wrong with my index. Worked after moving to a new index

---

<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:** [June 24, 2020, 7:01pm UTC](https://discuss.elastic.co/t/numberformatexception-for-query-field-in-simple-query-string/234602/5 "2020-06-24T19:01:24Z")

</div>

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