Getting "Text missing exception" while using custom analyzers in elasticserach

Hi Everyone

I am implementing custom analyzer using following methods.But iam getting text missing ERROR

In this below 3methods when i try to know whether the analyzer is applied or not by using
GET /sa/_analyze?analyzer=full_name
iam getting
{
"error": "ElasticsearchIllegalArgumentException[text is missing]",
"status": 400
}

METHOD1:
*first creating analyzer in settings and adding that anaylzer to the field in the mapping
POST sa
{
"settings":{
"analysis":{
"analyzer":{
"full_name":{
"filter":[

                    "lowercase"
                   
                    ],
                    "type":"custom",
                    "tokenizer":"standard"
            }
        }
    }

},
"mappings": {
"check":{
"properties": {
"name":{
"type": "string",
"analyzer": "full_name"
}
}
}
}
}

*indexing the data

POST sa/check/1
{
"_id":1,
"name":"BALU67 Guyfhf"
}

METHOD2
*indexing the data

POST sa/check/1
{
"_id":1,
"name":"BALU67 Guyfhf"
}

*Closing the index to change the settings
POST sa/_close

*creating the analyzer in the index settings

PUT sa/_settings
{
"analysis":{
"analyzer":{
"full_name":{
"filter":[
"standard",
"lowercase",
"asciifolding"
],
"type":"custom",
"tokenizer":"standard"
}
}
}
}

*opening the index
POST sa/_open

*Appying the created analyzer in the settings to the mapping

POST sa/check/_mapping?ignore_conflicts=true
{
"check":{
"properties": {
"name":{
"type":"string",
"analyzer":"full_name"
}
}
}
}

METHOD3:
*.IN settings creating the anaylzer

PUT /sa
{
"settings": {
"analysis": {
"analyzer": {
"ful_name": {
"filter":[

                    "lowercase"
                
                    ],
                    "type":"custom",
                    "tokenizer":"standard"
            }
        }
    }
}

}

*indxing the data

POST sa/check
{
"name":"CHA425 WUTH"
}

*Giving the created analyzer in the mapping

GET /sa/check/_mapping?ignore_conflicts=true
{
"check":{
"properties":{
"name":{
"type":"string",
"analyzer":"ful_name"
}
}
}
}

Now in the above 3methods when i use this GET /sa/_analyze?analyzer=full_name
iam getting "text missing error"
Can anyone please help me out in this.

Thanks

You have to provide "text" parameter to _analyze API.
"text" is the data what you want to analyze.

See: https://www.elastic.co/guide/en/elasticsearch/reference/2.1/indices-analyze.html

1 Like

Ya thanks a lot. Now my custom analyzer is effecting for the content i have given in the "text"

But one Dought

For example i have given

 GET /my_index/_analyze?analyzer=full_name&text=GSYDGSDJH

Now my custom analyzer will be effected only on that text

BUT if i index data to that mapping where i have given that custom analyzer it is not effecting..

POST sa/check
{

"name":"BALU67"
}

NOW actually it is not effecting above field when i search that field.even i have given my analyzer to that field in that mapping.

So is their any way that my analyzer should also effect the data of fields??

Thanks

If you want to know how to analyze based on a field mapping, you can use "field" parameter in _analyze API instead of "analyzer" parameter.