Unable to find analyzers


(Ben) #1

I don't appear to have the ability to add analyzers. I'm attempting the Spanish analyzer example from the ES website. My settings are as follows:

"settings" : {
          "index" : {
            "creation_date" : "1444061187427",
            "analysis" : {
              "analyzer" : {
                "es_std" : {
                  "type" : "standard",
                  "stopwords" : "_spanish_"
                },
                "content" : {
                  "type" : "custom",
                  "tokenizer" : "whitespace"
                }
              }
            },
            "number_of_shards" : "5",
            "number_of_replicas" : "2",
            "version" : {
              "created" : "1050299"
            },
            "uuid" : "lAUSIkAbKP2Jk-v3uXDFaB"
          }
        }

I then get the following response for this call:

curl -XGET -u dev-user:foobar 'https://foo.bar:1234/_analyze?analyzer=es_std' -d 'El veloz zorro marrón'

{"error":"ElasticsearchIllegalArgumentException[failed to find analyzer [es_std]]","status":400}

What am I doing wrong?

Thanks,
Ben


(Ben) #2

I've simplified my structure. Here's some updated JSON with more detail. I've tried a number of analyzers but still get the same error. I've trawled through the docs and have stripped the model right back to test but still can't figure this out.

{
  "myIndex" : {
    "aliases" : { },
    "mappings" : {
      "story" : {
        "properties" : {
          "clips" : {
            "properties" : {
              "description" : {
                "type" : "string"
              },
              "title" : {
                "type" : "string",
                "analyzer" : "es_std"
              }
            }
          },
          "title" : {
            "type" : "string"
          }
        }
      }
    },
    "settings" : {
      "index" : {
        "creation_date" : "1444089042546",
        "number_of_shards" : "5",
        "analysis" : {
          "analyzer" : {
            "es_std" : {
              "type" : "standard",
              "stopwords" : "_spanish_"
            }
          }
        },
        "number_of_replicas" : "1",
        "version" : {
          "created" : "1050299"
        },
        "uuid" : "wzmcLKSJDLGyX43yNBDzDQ"
      }
    },
    "warmers" : { }
  }
}

/_analyze?analyzer=es_std' -d 'El veloz zorro marrón'
{"error":"ElasticsearchIllegalArgumentException[failed to find analyzer [es_std]]","status":400}

(Magnus Bäck) #3

The "analysis" object goes straight under "settings". It's not nested under "index".

"settings" : {
  "analysis" : {
    "analyzer" : {
      ...
    }
  },
  ...
}

(Ben) #4

I've tried what you said but no luck - it places the analyzer below my index. Here are my exact steps. No other indexes exist.

curl -u dev-user:password -XPUT 'https://foo.com:10724/myindex?pretty'
{
  "acknowledged" : true
}

curl -u dev-user:password -XPOST 'https://foo.com:10724/myindex/_close?pretty'
{
  "acknowledged" : true
}

curl -u dev-user:password -XPUT 'https://foo.com:10724/_settings?pretty' -d '{"settings":{"analysis":{"analyzer":{"es_std":{ "type":"standard","stopwords":"_spanish_"}}}}}'
{
  "acknowledged" : true
}

curl -u dev-user:password -XPOST 'https://foo.com:10724/myindex/_open?pretty'
{
  "acknowledged" : true
}

curl -XGET -u dev-user:password 'https://foo.com:10724/myindex/?pretty&_mapping'
{
  "myindex" : {
    "aliases" : { },
    "mappings" : { },
    "settings" : {
      "index" : {
        "creation_date" : "1444119219943",
        "number_of_shards" : "5",
        "analysis" : {
          "analyzer" : {
            "es_std" : {
              "type" : "standard",
              "stopwords" : "_spanish_"
            }
          }
        },
        "number_of_replicas" : "2",
        "version" : {
          "created" : "1050299"
        },
        "uuid" : "iFm3U1RER2CopMwFSWAI3w"
      }
    },
    "warmers" : { }
  }
}

curl -XGET -u dev-user:password 'https://foo.com:10724/_analyze?analyzer=es_std&pretty' -d 'El veloz zorro marrón'
{
  "error" : "ElasticsearchIllegalArgumentException[failed to find analyzer [es_std]]",
  "status" : 400
}

(David Pilato) #5

Try this:

curl -XGET -u dev-user:password 'https://foo.com:10724/myindex/_analyze?analyzer=es_std&pretty' -d 'El veloz zorro marrón'

(Ben) #6

That's it! Many thanks everyone.


(system) #7