Multiple index is possible

i have table like emp,dep so there is any possible to create two doc type in single index i.e Put index/emp/1
put index/dep/1 like this

No, not in recent versions as document types are being deprecated. Read the blog post I linked to for further details and alternatives.

when i am trying to create index like this it will throw error

PUT twittera
{
"mappings": {
"user": {
"properties": {
"name": { "type": "text" },
"user_name": { "type": "keyword" },
"email": { "type": "keyword" }
}
},
"tweet": {
"properties": {
"content": { "type": "text" },
"user_name": { "type": "keyword" },
"tweeted_at": { "type": "date" }
}
}
}
}

error like this
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [tweet : {properties={tweeted_at={type=date}, user_name={type=keyword}, content={type=text}}}] [user : {properties={user_name={type=keyword}, name={type=text}, email={type=keyword}}}]"
}
],
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [tweet : {properties={tweeted_at={type=date}, user_name={type=keyword}, content={type=text}}}] [user : {properties={user_name={type=keyword}, name={type=text}, email={type=keyword}}}]",
"caused_by": {
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [tweet : {properties={tweeted_at={type=date}, user_name={type=keyword}, content={type=text}}}] [user : {properties={user_name={type=keyword}, name={type=text}, email={type=keyword}}}]"
}
},

Yes, that is expected as multiple types in an index is no longer supported. Please read the blog post I linked to.

than how can i achieve my requirement i want to map emp table dep in a single index
i.e 1.select * from emp,
2 select * from dep
or i can create different index ,but how can i relate both both table ,index join is possible
both data should be displayed in single index via logstash,there is any possible way to achieve this one

I'd totally forget about the existing model and would just think about the usage to build the right "search" objects for my use case.

Basically I'd recommend to ask yourself 2 questions:

  • What kind of objects my users want to get back as a response? If it's object X, then just index object X
  • What typical attributes my users want to search for? Let say I need attribute a, b and c, just index those attributes within object X whatever the original source of those attributes is.

HTH

thank for your reply

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.