Unexpected behaviour with search_as_you_type field indexed as arrays

curl -X PUT "localhost:9200/test_index?pretty" -H 'Content-Type: application/json' -d'
{
  "mappings": {
    "properties": {
      "search_as_you_type_field": {
        "type": "search_as_you_type"
      }
    }
  }
}
'

curl -X PUT "localhost:9200/test_index/_doc/1?refresh&pretty" -H 'Content-Type: application/json' -d'
{
  "search_as_you_type_field": ["owl", "quick brown fox dog"],
}
'

curl -X PUT "localhost:9200/test_index/_doc/2?refresh&pretty" -H 'Content-Type: application/json' -d'
{
  "search_as_you_type_field": ["quick brown fox dog", "owl"]
}
'

curl -X GET "localhost:9200/test_index/_search?pretty" -H 'Content-Type: application/json' -d'
{
  "query": {
    "match_phrase_prefix": {
      "search_as_you_type_field": {"query": "quick brown fox d"}
    }
  }
}
'
this returns the second document but not the first

match_phrase_prefix query on a search_as_you_type field doesn't seem to work properly as expected. In the example above first document is indexed with ["owl", "quick brown fox dog"],
querying q, qu, qui, .. quick b.. , quick brown f.. works but quick brown fox d, quick brown fox do, quick brown fox dog doesn't. However all the possible prefix queries works for the document 1.

I'm not sure this is an expected behavior but seems pretty strange and it is not documented anywhere

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