Elasticsearch 5.1.1 _suggest not working with mapping


(Shail Patel) #1

Here is the mapping I have:

{
  "ft_autocomplete_v2" : {
    "mappings" : {
      "ft" : {
        "properties" : {
          "nameSuggest" : {
            "properties" : {
              "input" : {
                "type" : "text",
                "fields" : {
                  "keyword" : {
                    "type" : "keyword",
                    "ignore_above" : 256
                  }
                }
              },
              "output" : {
                "type" : "text",
                "fields" : {
                  "keyword" : {
                    "type" : "keyword",
                    "ignore_above" : 256
                  }
                }
              },
              "payload" : {
                "properties" : {
                  "address" : {
                    "type" : "text",
                    "fields" : {
                      "keyword" : {
                        "type" : "keyword",
                        "ignore_above" : 256
                      }
                    }
                  },
                  "city" : {
                    "type" : "text",
                    "fields" : {
                      "keyword" : {
                        "type" : "keyword",
                        "ignore_above" : 256
                      }
                    }
                  },
                  "uuid" : {
                    "type" : "text",
                    "fields" : {
                      "keyword" : {
                        "type" : "keyword",
                        "ignore_above" : 256
                      }
                    }
                  }
                }
              },
              "suggest" : {
                "type" : "completion",
                "analyzer" : "standard",
                "preserve_separators" : false,
                "preserve_position_increments" : false,
                "max_input_length" : 50
              },
              "weight" : {
                "type" : "long"
              }
            }
          }
        }
      }
    }
  }
}

Here is the request I'm making:

curl -X POST -H "Content-Type: application/json" -d '{
    "sample-suggest" : {
        "prefix" : "A",
        "completion" : {
            "field" : "nameSuggest"
        }
    }
}' "http://localhost:17769/places/foursquare_autocomplete_v2/_suggest?pretty"

Error:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "no mapping found for field [nameSuggest]"
      }
    ],
    "type" : "search_phase_execution_exception",
    "reason" : "all shards failed",
    "phase" : "query",
    "grouped" : true,
    "failed_shards" : [
      {
        "shard" : 0,
        "index" : "ft_autocomplete_v2",
        "node" : "3-u2ZcPmQPiJYRAILIPQ_A",
        "reason" : {
          "type" : "illegal_argument_exception",
          "reason" : "no mapping found for field [nameSuggest]"
        }
      }
    ],
    "caused_by" : {
      "type" : "illegal_argument_exception",
      "reason" : "no mapping found for field [nameSuggest]"
    }
  },
  "status" : 400
}

I'm not sure why it is saying that nameSuggest doesn't have any mapping when it is defined? Or am I misunderstanding? The data in this index was migrated from ES 2.4.1. When I do a normally _search query, I'm able to get data back, so it wasn't corrupted or anything.


(system) #2

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