GithubHelp home page GithubHelp logo

It is possible? How to query combine must (AND) with must_not (NOT) using fast elasticsearch vector scoring about fast-elasticsearch-vector-scoring HOT 1 CLOSED

gabrielcustodio avatar gabrielcustodio commented on June 30, 2024
It is possible? How to query combine must (AND) with must_not (NOT) using fast elasticsearch vector scoring

from fast-elasticsearch-vector-scoring.

Comments (1)

lior-k avatar lior-k commented on June 30, 2024 1

Something like this:
Note that the vector in the "must_not" is the base64 variant. since this is how it is stored in the ES index

{
  "query": {
    "function_score": {

      "query": {
        "bool": {
           "must_not": [
           {
            "term": {
                "embeddings_vector": "vGcB1j3ytZc+JFH7PI/HjTx6XMU8Fli0vQO0FrqOh3O9fwMyvikswrwrEVG+h6ktveE82747pqY+dDoLvnlL+jyS8Mw8pbXiPou/eT4Wu9W97L7HvTyjMDu7+Fm9T8GOPMR+dL2ybnY8CoWevUnOQb4bMtQ77kkEPYyCrLzOUl49VxWPvdzZP7uy3hE80ZL6vhfc5T0pmKc9HK5TPg96Tz4xNgW+UPPeO/Zu372B+1m9IkAFvqqIG70BUvS+JCYpPqPZTL1Fy1s8nGDPPis2z7wwGoC9WklbPQyj+r3oS8e9mhlXPlv/9j5Gdbk9nTH1vYaLMz0Dvtk9xQYYPaLmwQ=="
            }
           }
           ]
        }
      },
      "script_score": {
      "script": {
        "inline" : "binary_vector_score_v2",
          "lang": "knn_v2",
          "params": {
            "cosine": false,
            "field": "embedding_vectorize_job_qm_no_executive_summary",
            "vector": [-0.08845212310552597, -0.08906011283397675, 0.24872203171253204, -0.35299643874168396, -0.11405511945486069, 0.007435183506458998, 0.014695641584694386, 0.0810081735253334, 0.08508744835853577, 0.04942350462079048, -0.19382385909557343, -0.3773375451564789, -0.08897750824689865, 0.003388628363609314, 0.19183564186096191, -0.036255933344364166, 0.04452558606863022, -0.24031603336334229, 0.09107230603694916, -0.11518114805221558, 0.01530667394399643, -0.05861687660217285, 0.00039576119161210954, -0.07696657627820969, -0.03465487062931061, -0.16033217310905457, 0.06700161844491959, 0.01648307405412197, 0.006644413806498051, 0.013184583745896816, -0.28751012682914734, -0.16328726708889008, -0.037366461008787155, -0.1065048947930336, 0.1911284625530243, 0.13403065502643585, -0.06778426468372345, -0.13069769740104675, 0.027110543102025986, 0.0690891444683075, -0.022418882697820663, -0.049506377428770065, -0.021799996495246887, 0.008504744619131088, 0.001444319961592555, 0.030824823305010796, -0.10882803797721863, -0.10402989387512207, -0.052981097251176834, -0.1305854469537735, 0.08872780948877335, 0.1431482434272766, 0.08793507516384125, -0.02266979031264782, 0.08263397961854935, -0.07393267750740051, 0.08551567047834396, -0.031177835538983345, 0.06870388984680176, -0.09644845873117447, 0.05066889896988869, 0.10879723727703094, 0.19038785994052887, 0.21654881536960602]
          }
        }
      }
    }
  },
  "size": 10
}

from fast-elasticsearch-vector-scoring.

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.