ElasticSearch Mapping

Common Issues with ElasticSearch:
1.) ElasticSearch Mapping is wrong.
  • Look at the server startup logs to see what port elastic search is bound to. Try 9200 9201 and 9300
  • curl -XGET 'http://localhost:9200/media_catalogs_public/asset/_mapping?pretty=true'
  • You should see entries like this: "country" : { "include_in_all" : false, "index" : "not_analyzed", "store" : "yes", "type" : "string" },
  • not_analyzed fields can be sorted
2.) ElasticSearch Index is out of date
  • shutdown the server
  • delete this folder: /WEB-INF/elastic
  • Startup the server and monitor the logs for errors
3.) ElasticSearch 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"
             }
           } ]
         }
       } ]
     }
   },
   "sort" : [ {
     "assetaddeddate" : {
       "order" : "desc"
     }
   } ]
}' | python -mjson.tool