Keyword analyzer not working as expected

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Keyword analyzer not working as expected

shoebalig
Hi There,

I have index mapping given below.
----------------
{
   "es_test": {
      "mappings": {
         "es_test_type": {
            "_all": {
               "enabled": true
            },
            "properties": {
               "Field1": {
                  "type": "string",
                  "store": true,
                  "analyzer": "keyword"
               },
               "Field2": {
                  "type": "string",
                  "store": true,
                  "analyzer": "standard"
               },
               "Field3": {
                  "type": "string",
                  "store": true,
                  "analyzer": "standard"
               },
               "RecordID": {
                  "type": "string",
                  "store": true,
                  "analyzer": "standard"
               },
               "Status": {
                  "type": "string",
                  "index": "not_analyzed",
                  "analyzer": "standard"
               },
               "Status.Code": {
                  "type": "string",
                  "index": "not_analyzed",
                  "analyzer": "standard"
               },
               "Status.Description": {
                  "type": "string",
                  "index": "not_analyzed",
                  "analyzer": "standard"
               }
            }
         }
      }
   }
}
---------
Input data
Field1,Field2,Field3
GAURAV GUPTA,SAURABH,MANI
GAURAV KUMAR GUPTA,SAURABH SHARMA,MANI RANA
GAURAV,SAURABH,MANI
gaurav gupta,saurabh sharma,mani
-------
Query:- 
POST /es_test/es_test_type/_search
{      "query": {
         "simple_query_string": {
            "query": "GAURAV GUPTA",
            "fields": [
               "Field2",
               "Field3",
               "Field1"
            ],
            "analyzer": "keyword",
            "default_operator": "or"
         }
      }
}
------------------------------
Out put
------------------------------
{
   "took": 11,
   "timed_out": false,
   "_shards": {
      "total": 1,
      "successful": 1,
      "failed": 0
   },
   "hits": {
      "total": 1,
      "max_score": 0.25604635,
      "hits": [
         {
            "_index": "es_test",
            "_type": "es_test_type",
            "_id": "3",
            "_score": 0.25604635,
            "_source": {
               "RecordID": "3",
               "Status": null,
               "Status.Code": null,
               "Status.Description": null,
               "Field1": "GAURAV",
               "Field2": "SAURABH",
               "Field3": "MANI"
            }
         }
      ]
   }
}


----------------

Out is not proper It should return first document  
GAURAV GUPTA,SAURABH,MANI

however it is returning 3rd document
GAURAV,SAURABH,MANI


Please suggest if i am doing something wrong??

--
Please update your bookmarks! We have moved to https://discuss.elastic.co/
---
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/dfb7a8fd-6df2-4a5e-b758-2e8e67d1af9b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.