Code Monkey home page Code Monkey logo

Comments (7)

snoopy83101 avatar snoopy83101 commented on July 18, 2024

Now I have to land the ES version to 5.x

from monstache.

rwynn avatar rwynn commented on July 18, 2024

Perhaps the best solution to that would be to use JavaScript to coerce the no field into a number array type. So, you would need to detect form 2 or form 3 and use code to transform to form 1. Delete the index and rerun monstache to reindex the data with same type.

Or if you don’t need to search this field you could simply set up a mapping in ES such that the no field is not indexed.

from monstache.

rwynn avatar rwynn commented on July 18, 2024

Example to disable a field if you choose to not transform in JavaScript.

https://www.elastic.co/guide/en/elasticsearch/reference/current/enabled.html

from monstache.

snoopy83101 avatar snoopy83101 commented on July 18, 2024

thx!
If I keep all,The best way should be。。。。。?
no.length>2
no=2
no.no1=1
Suppose all want to query

Is not only using the low version 5.x?

from monstache.

snoopy83101 avatar snoopy83101 commented on July 18, 2024

I do not quite understand why it(es 6) does not have a better solution, only to delete the index

from monstache.

rwynn avatar rwynn commented on July 18, 2024

To my knowledge there's no difference between ES 5 and 6 with regards to this. When using dynamic mapping the first document indexed determines the field types and subsequent documents must conform to that type.

Once the index is created, you cannot change the type mapping of existing fields in ES 5 or 6, only reindex the into another index or delete the index and recreate. Are you saying you can successfully index a field with multiple data types in ES 5?

The javascript I was thinking of would be something like

module.exports = function(doc) {
    if (doc.no) {
      if (!Array.isArray(doc.no)) {
         // only if ordering of values not important
         doc.no = _.values(doc.no);
      }
    }
    return doc;
}

from monstache.

snoopy83101 avatar snoopy83101 commented on July 18, 2024

I think I should understand. Thank you very much!

from monstache.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.