Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES 1.2.1 - boolean multifield silently ignored #6587

Closed
Omega359 opened this Issue Jun 23, 2014 · 10 comments

Comments

Projects
None yet
7 participants
@Omega359
Copy link

Omega359 commented Jun 23, 2014

I'm seeing multi-fields of type boolean silently being reduced to a normal boolean field in 1.2.1 which wasn't the behavior in 0.90.9. See https://gist.github.com/Omega359/0c2a93690b4db30693a1 for an example of this.

To me it seems like it should work - the boolean field mapper seems to be calling out to multiFieldsBuilder - but I'm not versed enough in the internals of ES to know where if at all it's broken.

@areek areek assigned rmuir and unassigned rmuir Jun 23, 2014

@s1monw

This comment has been minimized.

Copy link
Contributor

s1monw commented Jun 24, 2014

@martijnvg can you take a look at this?

@KlausBrunner

This comment has been minimized.

Copy link

KlausBrunner commented Oct 2, 2014

We're currently hitting the same problem. Our mapping (which used to work fine in 0.90.x and is necessary to allow certain queries based on user input) is:

 {
   "template_boolean": {
    "match": "*",
    "match_mapping_type": "boolean",
    "mapping": {
     "type": "multi_field",
     "fields": {
      "{name}": {
       "index": "not_analyzed",   // or "analyzed", doesn't really matter
       "type": "boolean",
       "include_in_all": true
      },
      "untouched": {
       "type": "boolean",
       "index": "not_analyzed"
      }
     }
    }
   }
  }

Which is silently ignored, the result is simply a {"type":"boolean"}. For other types than boolean, the same kind of template still works fine.

@KlausBrunner

This comment has been minimized.

Copy link

KlausBrunner commented Oct 7, 2014

@martijnvg I just realised we were still using the pre-1.0 syntax for multifields. However, it doesn't really improve with the proper new syntax: https://gist.github.com/KlausBrunner/9016653829d295ae96f2

Also, existing multifield mappings work just fine - but it's seemingly impossible to create new ones.

@KlausBrunner

This comment has been minimized.

Copy link

KlausBrunner commented Oct 14, 2014

@clintongormley Not to be a nuisance, but we're a bit bothered by this bug and I don't see an easy/obvious fix from browsing the code. Could someone look into this?

@clintongormley

This comment has been minimized.

Copy link
Member

clintongormley commented Oct 16, 2014

@KlausBrunner yes, currently there is no fields support for fields of type boolean. Out of interest, what are you trying to achieve with this mapping? The example you give just maps the same value in the same way twice.

I could imagine having a mapping like this:

{
  "mappings": {
    "test": {
      "properties": {
        "some_boolean_field": {
          "type": "string",
          "index": "not_analyzed",
          "fields": {
            "raw": {
              "type": "boolean"
            }
          }
        }
      }
    }
  }
}

which would index a not-analyzed string version and a boolean version, but the example you give doesn't make sense.

@KlausBrunner

This comment has been minimized.

Copy link

KlausBrunner commented Oct 16, 2014

@clintongormley You're right that the exact mapping in my example doesn't make a lot of sense, but in the case of booleans it doesn't matter for us anyway. We defined an additional "raw" (not_analyzed) mapping for all types of fields and rely on it to exist when we build queries. Until we switched to 1.x, this worked fine - now we need to have special treatment just for boolean fields, which is quite annoying.

@Omega359

This comment has been minimized.

Copy link
Author

Omega359 commented Oct 16, 2014

I'll echo Klaus - we have exactly the same scenario and special casing boolean fields just seems broken.

@clintongormley

This comment has been minimized.

Copy link
Member

clintongormley commented Oct 16, 2014

@KlausBrunner and @Omega359 so you'd rather index double the data? That seems odd to me...

@Omega359

This comment has been minimized.

Copy link
Author

Omega359 commented Oct 16, 2014

Than have custom code to handle a single type definition that doesn't behave like every other type we use? Yes.

@francoisforster

This comment has been minimized.

Copy link

francoisforster commented Feb 6, 2015

I need this feature to store a boolean that wasn't previously stored.
"type":"boolean",
"fields" : {
"stored" : {
"type":"boolean",
"index":"no",
"store":"yes"
}
}

jpountz added a commit to jpountz/elasticsearch that referenced this issue Dec 23, 2015

Add sub-fields support to `bool` fields.
`bool` is our only core mapper that does not support sub fields.

Close elastic#6587

jpountz added a commit that referenced this issue Dec 24, 2015

Add sub-fields support to `bool` fields.
`bool` is our only core mapper that does not support sub fields.

Close #6587
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.