1

Using sense, I'm trying to create a mapping for an index with three properties. When i try to create it i get the following response

{
   "error": "MapperParsingException[Root type mapping not empty after parsing! Remaining fields:   [mappings : {gram={properties={gram={type=string, fields={gram_bm25={type=string, similarity=BM25}, gram_lmd={type=string}}}, sentiment={type=string, index=not_analyzed}, word={type=string, index=not_analyzed}}}}]]",
   "status": 400
}

This is what i have in the sense console

PUT /pos/_mapping/gram
{
  "mappings": {
    "gram": {
      "properties": {
        "gram": {
          "type": "string",
          "fields": {
            "gram_bm25": {
              "type": "string", "similarity": "BM25"
            },
            "gram_lmd": {
              "type": "string"
            }
          }
        },
        "sentiment": {
          "type": "string", "index": "not_analyzed"
        },
        "word": {
          "type": "string", "index": "not_analyzed"
        }
      }
    }
  }
}
  • The name of the index is 'pos' and I call the type 'gram'.
  • I have created the index with the same name.
  • I have validated the json using http://jsonlint.com/
  • I tried using XPUT in the console and i got the 'aknowleged' response, but the mapping is still {} when i request it in sense.
  • this question does not solve my problem. I always use the same name everywhere. Any suggestions?

Thanks!

1 Answer 1

1

You just have the API syntax wrong. You've combined two different methods, basically.

Either create your index, then apply a mapping:

DELETE /pos

PUT /pos

PUT /pos/gram/_mapping
{
   "gram": {
      "properties": {
         "gram": {
            "type": "string",
            "fields": {
               "gram_bm25": {
                  "type": "string",
                  "similarity": "BM25"
               },
               "gram_lmd": {
                  "type": "string"
               }
            }
         },
         "sentiment": {
            "type": "string",
            "index": "not_analyzed"
         },
         "word": {
            "type": "string",
            "index": "not_analyzed"
         }
      }
   }
}

Or do it all at once when you create the index:

DELETE /pos

PUT /pos
{
   "mappings": {
      "gram": {
         "properties": {
            "gram": {
               "type": "string",
               "fields": {
                  "gram_bm25": {
                     "type": "string",
                     "similarity": "BM25"
                  },
                  "gram_lmd": {
                     "type": "string"
                  }
               }
            },
            "sentiment": {
               "type": "string",
               "index": "not_analyzed"
            },
            "word": {
               "type": "string",
               "index": "not_analyzed"
            }
         }
      }
   }
}

Here's the code I used:

http://sense.qbox.io/gist/6d645cc069f5f0fcf14f497809f7f79aff7de161

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.