# Match based on array input?

**URL:** <https://forum.opensearch.org/t/match-based-on-array-input/14756>\
**Category:** OpenSearch\
**Created:** [June 20, 2023, 4:02pm UTC](https://forum.opensearch.org/t/match-based-on-array-input/14756 "2023-06-20T16:02:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![manugarri](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@manugarri](https://forum.opensearch.org/u/manugarri)\
**Post date:** [June 20, 2023, 4:02pm UTC](https://forum.opensearch.org/t/match-based-on-array-input/14756/1 "2023-06-20T16:02:55Z")

</div>

**Versions** (relevant - OpenSearch/Dashboard/Server OS/Browser):

Opensearch 2.5

**Describe the issue** :  
I have setup a cluster at my company to match fuzzy input business information to our database.  
The input data looks like this:

```auto
names: ["Acme Corp, Inc", "acme inc", "The Acme corporation"]
addresses: ["123 Main street", "123 main st."]

```

As you can see, all the records are of the same business, but we receive different variation of the name and/or the address.

I am setting up the query like this:

```auto
    query = {
      "_source": "business",  
      "size": 5,
      "fields": [
        "names",
        "id",
        "addresses"
      ],    
      "query": {
        "bool": {
          "should": [
            {
              "match": {
                "names": {"query": names, "boost":10, "fuzziness": "AUTO"},
              }
            },
            {
              "match": {
                "addresses": {"query": addresses, "boost":1, "fuzziness": "AUTO"},

              }
            }
          ],
       "filter": {
              "geo_distance": {
                 "distance": f"{RADIUS}km",
                   "coordinates": {
                      "lat": lat,
                      "lon": lon
                    }
                 }
            }
        }
      }
    }

```

However, running this query fails with the following error:

```auto
RequestError(400, 'x_content_parse_exception', '[match] unknown token [START_ARRAY] after [query]')

```

How can I make Opensearch accept the input as an array?

**Configuration** :

**Relevant Logs or Screenshots** :

---

<div class="post-metadata">

**Author:** ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/10363_2.png) [@pablo](https://forum.opensearch.org/u/pablo)\
**Post date:** [June 20, 2023, 4:49pm UTC](https://forum.opensearch.org/t/match-based-on-array-input/14756/2 "2023-06-20T16:49:17Z")

</div>

@manugarri `query` is a keyword and I think your match is incorrect. You should use curly brackets with a `query` keyword.

Could you share a sample of your document and index mappings?

What is the expected result of this query?

---

<div class="post-metadata">

**Author:** ![manugarri](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@manugarri](https://forum.opensearch.org/u/manugarri)\
**Post date:** [June 20, 2023, 5:36pm UTC](https://forum.opensearch.org/t/match-based-on-array-input/14756/3 "2023-06-20T17:36:10Z")

</div>

hey Pablo, i wrote pseudocode, but I believe i used curly brackets…

Regarding examples, i shared one input example, and the index docs look similar:

```auto
_id:1
fields: {
"names": ["business name 1", "business name 2"]
"addresses":["Address 1", "Address 2"]
}

```
