Common problems with Elastic Search:

  1. Mapping is wrong.
    1. Look at the server startup logs to see what port elastic search is bound to. Try 9200 9201 and 9300
    2. curl -XGET 'http://localhost:9200/media_catalogs_public/asset/_mapping?pretty=true'
    3. You should see entries like this:
      "country" : {
              "include_in_all" : false,
              "index" : "not_analyzed",
              "store" : "yes",
              "type" : "string"
            },
    4. not_analyzed fields can be sorted
  2. Index is out of date
    1. shutdown the server
    2. delete this folder: /WEB-INF/elastic
    3. Startup the server and monitor the logs for errors
  3. Search results are not accurate

    curl -XPOST 'http://localhost:9200/media_catalogs_public/asset/_search' -d '
    {"query" :
        {
            "match_all" : {}
        }
    }' | python -mjson.tool

    curl -XPOST 'http://localhost:9200/media_catalogs_public/asset/_search' -d '
    {
       "query" : {
         "bool" : {
           "must" :  {
             "term" : {
               "category" : "index"
             }
           }, {
             "bool" : {
               "should" :  {
                 "term" : {
                   "viewasset" : "true"
                 }
               }, {
                 "term" : {
                   "viewasset" : "sgroupadministrator"
                 }
               }, {
                 "term" : {
                   "viewasset" : "profileassetadmin"
                 }
               }, {
                 "term" : {
                   "viewasset" : "profileviewassets"
                 }
               }, {
                 "term" : {
                   "viewasset" : "administrators"
                 }
               }, {
                 "term" : {
                   "viewasset" : "visualdata"
                 }
               }, {
                 "term" : {
                   "viewasset" : "admin"
                 }
               } *
             }
           } .html">*
         }
       },
       "sort" :  {
         "assetaddeddate" : {
           "order" : "desc"
         }
       } *
    }' | python -mjson.tool