Suggester not returning and hits

Elasticsearch version ( bin/elasticsearch --version ):
5.6.11
Plugins installed :

JVM version ( java -version ):
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~16.04.1-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)

OS version ( uname -a if on a Unix-like system):
Linux myserver 4.4.0-131-generic #157-Ubuntu SMP Thu Jul 12 15:51:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Description of the problem including expected versus actual behavior :
I'm trying to learn and use suggesters and stumbled upon the phrase suggester which seems most appropriate for my case where the order of the terms by the user shouldn't matter.

My mapping/index/etc.

  "my_special_index": {
    "aliases": {},
    "mappings": {
      "my_special_index": {
        "properties": {
          "books": {
            "type": "nested",
            "properties": {
              "name": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword"
                  },
                  "trigram": {
                    "type": "text",
                    "analyzer": "trigram"
                  }
                }
              }
            }
          }
        }
      }
    },
    "settings": {
      "index": {
        "number_of_shards": "5",
        "provided_name": "my_special_index",
        "creation_date": "1605193127758",
        "analysis": {
          "filter": {
            "shingle": {
              "max_shingle_size": "3",
              "min_shingle_size": "2",
              "type": "shingle"
            }
          },
          "normalizer": {
            "lowerasciinormalizer": {
              "filter": "lowercase,asciifolding",
              "type": "custom"
            }
          },
          "analyzer": {
            "trigram": {
              "filter": [
                "shingle",
                "lowercase"
              ],
              "type": "custom",
              "tokenizer": "standard"
            }
          },
          "tokenizer": {
            "autocomplete": {
              "token_chars": [
                "letter"
              ],
              "min_gram": "2",
              "type": "edge_ngram",
              "max_gram": "10"
            }
          }
        },
        "number_of_replicas": "1",
        "uuid": "xasdasdad",
        "version": {
          "created": "5061699"
        }
      }
    }
  }
}

How i'm querying ES:

GET my_special_index/_search
{
  "suggest": {
    "text": "harry potter and the",
    "phrase_fixer": {
      "phrase": {
        "field": "books.name.trigram"
      }
    }
  }
}

output:

{
  "took": 26,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 0,
    "max_score": 0,
    "hits": []
  },
  "suggest": {
    "phrase_fixer": [
      {
        "text": "harry potter and the",
        "offset": 0,
        "length": 20,
        "options": []
      }
    ]
  }
}

Can anyone see what I might be missing?

Thanks in advance!

Solved it by creating a separate index with just the names

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