# Search-as-you-type datatype + text array = not working

**URL:** <https://discuss.elastic.co/t/search-as-you-type-datatype-text-array-not-working/215888>\
**Category:** Elasticsearch\
**Created:** [January 21, 2020, 1:42pm UTC](https://discuss.elastic.co/t/search-as-you-type-datatype-text-array-not-working/215888 "2020-01-21T13:42:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![traed](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/traed/32/61130_2.png) [@traed](https://discuss.elastic.co/u/traed)\
**Post date:** [January 21, 2020, 1:42pm UTC](https://discuss.elastic.co/t/search-as-you-type-datatype-text-array-not-working/215888/1 "2020-01-21T13:42:37Z")

</div>

I'm trying out the search\_as\_you\_type datatype instead of implementing a custom analyser for autosuggestions. My old solution worked when searching a text-field such as:

```
'text' => [
	'type' => 'text',
	'fields' => [
		'suggest' => [
			'type' => 'text',
			'analyzer' => 'autosuggest',
			'search_analyzer' => 'standard',
		]
	]
]

```

Where a document could be:

```
{
	"_index": "someindex",
	"_type": "_doc",
	"_id": "1",
	"_source": {
		"text": [
			"some text",
			"other text"
		],
		"original_text": null,
		"status": "good"
	}
}

```

And the search query would a bool query containing:

```
bool: {
	must: [
		{
			multi_match: {
				query: "some",
				fields: ['text.suggest^2', 'original_text.suggest'],
				fuzziness: 'AUTO'
			}
		}
	],
	filter: [
		terms: {
			status: "good"
		}
	]
}

```

The text field can be either a string or an array of strings. When changing the text field mapping to:

```
'text' => [
	'type' => 'search_as_you_type'
]

```

... and the query to:

```
bool: {
	must: [
		{
			multi_match: {
				query: "some",
				fields: [
					'text^10',
					'text._index_prefix^2',
					'original_text',
					'original_text._index_prefix',
				],
				fuzziness: 'AUTO'
			}
		}
	],
	filter: [
		terms: {
			status: "good"
		}
	]
}

```

... i still get results where text is a single string, but documents where text is an array of strings don't show up. How come?

---

<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 18, 2020, 1:42pm UTC](https://discuss.elastic.co/t/search-as-you-type-datatype-text-array-not-working/215888/2 "2020-02-18T13:42:40Z")

</div>

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