Same name fields in two mappings disable indexing in one mapping


(Yogesh BG) #1

Hi

I have two mappings, mapping1 and mapping2... mapping1 goes to index1 and mapping2 to index2.

But mapping1 and mapping2 are same. Want to enable index in mapping1 and disable in mapping2.

How to do this?


(David Pilato) #2

Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.


(Yogesh BG) #3

These are the two mappings goes into two indices

Blockquote
{
"template": "*-accesslog",
"order": 10,
"mappings": {
"accesslog1": {
"_all": {
"enabled": false
},
"properties": {
"accountId": {
"type": "string",
"index_options": "docs",
"norms": {
"enabled": false
},
"index": "not_analyzed"
},
"applicationId": {
"type": "string",
"index_options": "docs",
"norms": {
"enabled": false
},
"index": "not_analyzed"
},
"requestSize": {
"type": "long",
"doc_values": false,
"norms": {
"enabled": false
},
"index": "no"
},
"requestStartTime": {
"type": "long",
"doc_values": false,
"norms": {
"enabled": false
},
"index": "no"
},
"requestEndTime": {
"type": "long",
"doc_values": false,
"norms": {
"enabled": false
},
"index": "no"
}
}
}

Blockquote
{
"template": "thunder-*",
"order": 10,
"mappings": {
"accesslog2": {
"_all": {
"enabled": false
},
"properties": {
"accountId": {
"type": "string",
"doc_values": true,
"index": "not_analyzed"
},
"applicationId": {
"type": "string",
"doc_values": true,
"index": "not_analyzed"
},
"requestSize": {
"type": "long",
"doc_values": true,
"index": "not_analyzed"
},
"requestStartTime": {
"type": "long",
"doc_values": true,
"index": "not_analyzed"
},
"requestEndTime": {
"type": "long",
"doc_values": true,
"index": "not_analyzed"
}
}
}
}
}
"

here thogh they are different indices, when i post the record i get the exception saying fields with same name has different index option in another index. Can you help me how can i put analyzer to be different so that they dont collide?


(Christian Dahlqvist) #4

The index templates have the same order and one is using a suffix while the other one is using a prefix to match the indices to apply to. What is the name of your index that is causing the problem?


(Yogesh BG) #5

has the same name same type, but value for index is different not_analyzed and no

this is causing the problem... in one index i want to disable and in another i want to enable


(Christian Dahlqvist) #6

What is the name of the indices? When are you getting problems, when indexing or querying?


(Yogesh BG) #7

i am getting problem when indexing

index1 - agsjh-4njbn-j333-accesslog
index2 - thunder-agsjh-4njbn-j333


(Christian Dahlqvist) #8

Can you show the exact error you are getting?


(system) #9

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