Flowpack.SearchPlugin: unknown key [analysis] for create index

Good morning,

I use the Flowpack.SearchPlugin in combination with the Flowpack.ElasticSearch.ContentRepositoryAdaptor and autocompletion on the search input with the js libary autocomplete.
As described here therefore I set the following config:

Flowpack:
  ElasticSearch:
    indexes:
      default:      # client name used to connect (see Flowpack.ElasticSearch.clients)
        zweicom:    # your (custom) index name
          analysis:
            filter:
              autocompleteFilter:
                max_shingle_size: 5
                min_shingle_size: 2
                type: 'shingle'
            analyzer:
              autocomplete:
                filter: [ 'lowercase', 'autocompleteFilter' ]
                char_filter: [ 'html_strip' ]
                type: 'custom'
                tokenizer: 'standard'

When I try to use the autocomplete-source https://develop.itoop.de/flowpack/searchplugin?contextNodeIdentifier=6803d200-7c87-4ccf-9ec5-bbcf228a662a&dimensionCombination={"language"%3A["de"]} by setting the term parameter manually like this…

https://develop.itoop.de/flowpack/searchplugin?term=kontakt&contextNodeIdentifier=6803d200-7c87-4ccf-9ec5-bbcf228a662a&dimensionCombination=%7B%22language%22%3A%5B%22de%22%5D%7D

…I get an Elasticsearch error:

{"completions":[],"suggestions":[],"errors":["Could not execute query: Elasticsearch request failed:\n\n[POST http:\/\/myuser:mypassword@94.130.131.131:8080\/zweicom-fb11fdde869d0a8fcfe00a2fd35c031d\/_search]: Array\n(\n [root_cause] => Array\n (\n [0] => Array\n (\n [type] => illegal_argument_exception\n [reason] => no mapping found for field [neos_suggestion]\n )\n\n )\n\n [type] => search_phase_execution_exception\n [reason] => all shards failed\n [phase] => query\n [grouped] => 1\n [failed_shards] => Array\n (\n [0] => Array\n (\n [shard] => 0\n [index] => zweicom-fb11fdde869d0a8fcfe00a2fd35c031d-1602280348\n [node] => oTxLkVlUQuGZlAU4gJrKlw\n [reason] => Array\n (\n [type] => illegal_argument_exception\n [reason] => no mapping found for field [neos_suggestion]\n )\n\n )\n\n )\n\n [caused_by] => Array\n (\n [type] => illegal_argument_exception\n [reason] => no mapping found for field [neos_suggestion]\n [caused_by] => Array\n (\n [type] => illegal_argument_exception\n [reason] => no mapping found for field [neos_suggestion]\n )\n\n )\n\n)\n\n\n\n\nRequest data: \n\n{\"query\":{\"bool\":{\"must\":[{\"match_all\":{\"boost\":1}}],\"filter\":{\"bool\":{\"must\":[{\"bool\":{\"should\":[{\"term\":{\"neos_parent_path\":\"\\\/sites\\\/itoop-zweicomde\"}},{\"term\":{\"neos_path\":\"\\\/sites\\\/itoop-zweicomde\"}}]}},{\"terms\":{\"neos_workspace\":[\"live\"]}},{\"prefix\":{\"neos_completion\":\"kontakt\"}}],\"should\":[],\"must_not\":[{\"term\":{\"neos_hidden\":true}},{\"range\":{\"neos_hidden_before_datetime\":{\"gt\":\"now\"}}},{\"range\":{\"neos_hidden_after_datetime\":{\"lt\":\"now\"}}}]}}}},\"_source\":[\"neos_path\",\"title\"],\"size\":0,\"aggregations\":{\"autocomplete\":{\"terms\":{\"field\":\"neos_completion\",\"order\":{\"_count\":\"desc\"},\"include\":\"kontakt.*\",\"size\":10}}},\"suggest\":{\"suggestions\":{\"prefix\":\"kontakt\",\"completion\":{\"field\":\"neos_suggestion\",\"fuzzy\":true,\"size\":10,\"contexts\":{\"parent_path\":\"\\\/sites\\\/itoop-zweicomde\",\"workspace\":\"live\"}}}}}\n\n\n\nResponse body:\n\n{\"error\":{\"root_cause\":[{\"type\":\"illegal_argument_exception\",\"reason\":\"no mapping found for field [neos_suggestion]\"}],\"type\":\"search_phase_execution_exception\",\"reason\":\"all shards failed\",\"phase\":\"query\",\"grouped\":true,\"failed_shards\":[{\"shard\":0,\"index\":\"zweicom-fb11fdde869d0a8fcfe00a2fd35c031d-1602280348\",\"node\":\"oTxLkVlUQuGZlAU4gJrKlw\",\"reason\":{\"type\":\"illegal_argument_exception\",\"reason\":\"no mapping found for field [neos_suggestion]\"}}],\"caused_by\":{\"type\":\"illegal_argument_exception\",\"reason\":\"no mapping found for field [neos_suggestion]\",\"caused_by\":{\"type\":\"illegal_argument_exception\",\"reason\":\"no mapping found for field [neos_suggestion]\"}}},\"status\":400}"]}

“Normal” search queries (e.g. http://94.130.131.131:8080/_search?q=kontakt) are working:

{"took":6,"timed_out":false,"_shards":{"total":3,"successful":3,"skipped":0,"failed":0},"hits":{"total":{"value":4,"relation":"eq"},"max_score":3.5675135,"hits":[{"_index":"zweicom-e781f29c8dd927c09735547a848e3459-1602280348","_type":"_doc","_id":"14dbe7a286e0874d809e9db19aabd32b8f150918","_score":3.5675135,"_source":{"neos_hidden_after_datetime":null,"neos_last_publication_date_time":"2020-09-21T05:16:46+00:00","neos_fulltext_parts":{"6610f222-a1ed-4c57-a66f-f2feada4d820":{"h1":" Kontakt"}},"neos_parent_path":["/","/sites","/sites/itoop-zweicomde"],"neos_creation_date_time":"2020-09-21T05:14:31+00:00","neos_sort_index":550,"targetMode":"firstChildNode","neos_last_modification_date_time":"2020-09-21T05:16:46+00:00","neos_workspace":"user-hohmannzweicom","title":"Kontakt","neos_type_and_supertypes":["Neos.Neos:Shortcut","Neos.Neos:Document","Neos.Neos:Node","Neos.Neos:Hidable","Neos.Neos:Timable","Neos.Seo:TitleTagMixin","Neos.Seo:SeoMetaTagsMixin","Neos.Seo:TwitterCardMixin","Neos.Seo:CanonicalLinkMixin","Neos.Seo:OpenGraphMixin","Neos.Seo:XmlSitemapMixin","Neos.Seo:NoindexMixin"],"metaRobotsNoindex":null,"target":null,"neos_node_identifier":"6610f222-a1ed-4c57-a66f-f2feada4d820","neos_fulltext":{"h1":"Kontakt"},"neos_path":"/sites/itoop-zweicomde/node-fe5i7fl381ja5","neos_hidden_before_datetime":null,"neos_hidden_in_index":false,"uriPathSegment":"kontakt","neos_hidden":false,"neos_type":"Neos.Neos:Shortcut"}},{"_index":"zweicom-e781f29c8dd927c09735547a848e3459-1602280348","_type":"_doc","_id":"6bb62db22efdf169076174123c2745618d1d0386","_score":3.5675135,"_source":{"neos_hidden_after_datetime":null,"neos_last_publication_date_time":"2020-09-21T05:16:46+00:00","neos_fulltext_parts":{"6610f222-a1ed-4c57-a66f-f2feada4d820":{"h1":" Kontakt"}},"neos_parent_path":["/","/sites","/sites/itoop-zweicomde"],"neos_creation_date_time":"2020-09-21T05:14:31+00:00","neos_sort_index":550,"targetMode":"firstChildNode","neos_last_modification_date_time":"2020-09-21T05:16:46+00:00","neos_workspace":"live","title":"Kontakt","neos_type_and_supertypes":["Neos.Neos:Shortcut","Neos.Neos:Document","Neos.Neos:Node","Neos.Neos:Hidable","Neos.Neos:Timable","Neos.Seo:TitleTagMixin","Neos.Seo:SeoMetaTagsMixin","Neos.Seo:TwitterCardMixin","Neos.Seo:CanonicalLinkMixin","Neos.Seo:OpenGraphMixin","Neos.Seo:XmlSitemapMixin","Neos.Seo:NoindexMixin"],"metaRobotsNoindex":null,"target":null,"neos_node_identifier":"6610f222-a1ed-4c57-a66f-f2feada4d820","neos_fulltext":{"h1":"Kontakt"},"neos_path":"/sites/itoop-zweicomde/node-fe5i7fl381ja5","neos_hidden_before_datetime":null,"neos_hidden_in_index":false,"uriPathSegment":"kontakt","neos_hidden":false,"neos_type":"Neos.Neos:Shortcut"}},{"_index":"zweicom-fb11fdde869d0a8fcfe00a2fd35c031d-1602280348","_type":"_doc","_id":"09fc1e9ea8a3264eff3bdbff5a09425c983e7377","_score":3.5675135,"_source":{"neos_hidden_after_datetime":null,"neos_last_publication_date_time":"2020-09-21T05:16:46+00:00","neos_fulltext_parts":{"6610f222-a1ed-4c57-a66f-f2feada4d820":{"h1":" Kontakt"}},"neos_parent_path":["/","/sites","/sites/itoop-zweicomde"],"neos_creation_date_time":"2020-09-21T05:14:31+00:00","neos_sort_index":550,"targetMode":"firstChildNode","neos_last_modification_date_time":"2020-09-21T05:16:46+00:00","neos_workspace":"live","title":"Kontakt","neos_type_and_supertypes":["Neos.Neos:Shortcut","Neos.Neos:Document","Neos.Neos:Node","Neos.Neos:Hidable","Neos.Neos:Timable","Neos.Seo:TitleTagMixin","Neos.Seo:SeoMetaTagsMixin","Neos.Seo:TwitterCardMixin","Neos.Seo:CanonicalLinkMixin","Neos.Seo:OpenGraphMixin","Neos.Seo:XmlSitemapMixin","Neos.Seo:NoindexMixin"],"metaRobotsNoindex":null,"target":null,"neos_node_identifier":"6610f222-a1ed-4c57-a66f-f2feada4d820","neos_fulltext":{"h1":"Kontakt"},"neos_path":"/sites/itoop-zweicomde/node-fe5i7fl381ja5","neos_hidden_before_datetime":null,"neos_hidden_in_index":false,"uriPathSegment":"kontakt","neos_hidden":false,"neos_type":"Neos.Neos:Shortcut"}},{"_index":"zweicom-fb11fdde869d0a8fcfe00a2fd35c031d-1602280348","_type":"_doc","_id":"b9bc02fedf6780839764176fc7039b3d6fcc93c4","_score":3.5675135,"_source":{"neos_hidden_after_datetime":null,"neos_last_publication_date_time":"2020-09-21T05:16:46+00:00","neos_fulltext_parts":{"6610f222-a1ed-4c57-a66f-f2feada4d820":{"h1":" Kontakt"}},"neos_parent_path":["/","/sites","/sites/itoop-zweicomde"],"neos_creation_date_time":"2020-09-21T05:14:31+00:00","neos_sort_index":550,"targetMode":"firstChildNode","neos_last_modification_date_time":"2020-09-21T05:16:46+00:00","neos_workspace":"user-hohmannzweicom","title":"Kontakt","neos_type_and_supertypes":["Neos.Neos:Shortcut","Neos.Neos:Document","Neos.Neos:Node","Neos.Neos:Hidable","Neos.Neos:Timable","Neos.Seo:TitleTagMixin","Neos.Seo:SeoMetaTagsMixin","Neos.Seo:TwitterCardMixin","Neos.Seo:CanonicalLinkMixin","Neos.Seo:OpenGraphMixin","Neos.Seo:XmlSitemapMixin","Neos.Seo:NoindexMixin"],"metaRobotsNoindex":null,"target":null,"neos_node_identifier":"6610f222-a1ed-4c57-a66f-f2feada4d820","neos_fulltext":{"h1":"Kontakt"},"neos_path":"/sites/itoop-zweicomde/node-fe5i7fl381ja5","neos_hidden_before_datetime":null,"neos_hidden_in_index":false,"uriPathSegment":"kontakt","neos_hidden":false,"neos_type":"Neos.Neos:Shortcut"}}]

When I use ./flow nodeindex:build I get

Creating indices and apply mapping... Elasticsearch request failed:
[PUT
http://myuser:mypassword@94.130.131.131:8080/zweicom-fb11fdde869d0a8fcfe00a2fd35c031d-1602824440/]:
Array
(
    [root_cause] => Array
        (
            [0] => Array
                (
                    [type] => parse_exception
                    [reason] => unknown key [analysis] for create index
                )

        )

    [type] => parse_exception
    [reason] => unknown key [analysis] for create index
)


Request data:

{"analysis":{"filter":{"autocompleteFilter":{"max_shingle_size":5,"min_shingle_size":2,"type":"shingle"}},"analyzer":{"autocomplete":{"filter":["lowercase","autocompleteFilter"],"char_filter":["html_strip"],"type":"custom","tokenizer":"standard"}}}}

Response body:

{"error":{"root_cause":[{"type":"parse_exception","reason":"unknown key
[analysis] for create index"}],"type":"parse_exception","reason":"unknown
key [analysis] for create index"},"status":400}

  Type: Flowpack\ElasticSearch\Transfer\Exception\ApiException
  Code: 1338977435
  File:
Data/Temporary/Development/Cache/Code/Flow_Object_Classes/Flowpack_ElasticS
        earch_Transfer_Response.php
  Line: 54

Open Data/Logs/Exceptions/2020101605004008b81f.txt for a full stack
trace.

  Type: Neos\Flow\Core\Booting\Exception\SubProcessException
  Code: 1355480641
  File: Packages/Framework/Neos.Flow/Classes/Core/Booting/Scripts.php
  Line: 699

Open Data/Logs/Exceptions/202010160500342f5752.txt for a full stack trace.

Any idea what I’m doing wrong?

Hey Andre,

which versions of the SearchPlugin, the CR-Adapter and Elasticsearch are you using?

Hi Daniel,

SeachPlugin: 5.0.0
CR-Adapter: 7.0.4
Elasticsearch: 7.9.3