Question

I'm struggling to implement FLT into the prototype ES system I am building. I've looked at the documentation on Elasticsearch website and although it's there, I can't seem to get this working. Perhaps someone out there can give me a little insight on how to do this.

I can't seem to find any examples of this being done elsewhere on the web, but perhaps my Google skills aren't up to scratch today. This is what I've managed to construct so far -

$ curl -XGET 'http://127.0.0.1:9200/uber/uber/_search?'  -d '{
  "fuzzy_like_this": {
    "fields": [
      "pty_firstname",
      "pty_surname"
    ],
    "like_text": "Nathan Andew",
    "max_query_terms": 12
  }
}'

Here is the error message I am receiving from my prompt upon sending the request -

{
  "error":"SearchPhaseExecutionException[Failed to execute phase [query], total failure;
          shardFailures {[u9HfJxbXRn-8ml19FKBTiA][uber][2]: SearchParseException[[uber][2]: from[-1],size[-1]:
            Parse Failure [Failed to parse source [
              {
                "fuzzy_like_this": {
                "fields": [
                  "pty_firstname",
                  "pty_surname"
                ],
                "like_text": "Nathan Andew",
                "max_query_terms": 12
                }
              }
            ]]]; nested: SearchParseException[[uber][2]: from[-1],size[-1]:
            Parse Failure [No parser for element [fuzzy_like_this]]]; }{[u9HfJxbXRn-8ml19FKBTiA][uber][0]:
          SearchParseException[[uber][0]: from[-1],size[-1]:
            Parse Failure [Failed to parse source [
              {
                "fuzzy_like_this": {
                "fields": [
                  "pty_firstname",
                  "pty_surname"
                ],
                "like_text": "Nathan Andew",
                "max_query_terms": 12
                }
              }
            ]]]; nested: SearchParseException[[uber][0]: from[-1],size[-1]:
            Parse Failure [No parser for element [fuzzy_like_this]]]; }]",
  "status":500
}
Était-ce utile?

La solution

I think that you are missing the query part, you need to do something like:

$ curl -XPOST 'http://127.0.0.1:9200/uber/uber/_search?'  -d '
{
  "query" : {
    "fuzzy_like_this" : {
       "fields" : ["pty_firstname", "pty_surname"],
       "like_text" : "Nathan Andew",
       "max_query_terms" : 12
    }
  }
}'
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top