Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

yuhnevic@gmail.com's avatar

Scout and ElasticSearch issue.

Hello! I have issue with scout, actually I can't do prefix search via scout using elastic engine. I've already configured my elastic server to use edgeNgram as word prefix analyzer. I have this settings in my elastic config:

  "help" : {
    "aliases" : { },
    "mappings" : {
      "article_contents" : {
        "properties" : {
          "content" : {
            "type" : "string",
            "fields" : {
              "ngram" : {
                "type" : "string",
                "analyzer" : "ngram_index_analyzer",
                "search_analyzer" : "ngram_search_analyzer"
              }
            }
          },
          "generated_content" : {
            "type" : "string",
            "fields" : {
              "ngram" : {
                "type" : "string",
                "analyzer" : "ngram_index_analyzer",
                "search_analyzer" : "ngram_search_analyzer"
              }
            }
          },
          "title" : {
            "type" : "string",
            "fields" : {
              "ngram" : {
                "type" : "string",
                "analyzer" : "ngram_index_analyzer",
                "search_analyzer" : "ngram_search_analyzer"
              }
            }
          }
        }
      }
    },
    "settings" : {
      "index" : {
        "analysis" : {
          "filter" : {
            "ngram" : {
              "type" : "edgeNGram",
              "min_gram" : "1",
              "max_gram" : "50"
            }
          },
          "analyzer" : {
            "ngram_index_analyzer" : {
              "filter" : [ "lowercase", "ngram" ],
              "tokenizer" : "standard"
            },
            "ngram_search_analyzer" : {
              "filter" : [ "lowercase" ],
              "tokenizer" : "standard"
            }
          }
        },
        "number_of_replicas" : "0",
        "number_of_shards" : "1",
        "version" : {
          "created" : "2030499"
        }
      }
    },
    "warmers" : { }
  }
}```

and when I make this request: curl -XGET "http://localhost:9200/help/_search?q=dash&pretty"
it returns empty array in hits.

But when I make query a bit different, curl -XGET "http://localhost:9200/help/_search?q=title.ngram:dash&pretty"
it returns two correct results, but all of that happens inside of the terminal.

Thank you for your help :)
0 likes
0 replies

Please or to participate in this conversation.