Giter VIP home page Giter VIP logo

Comments (6)

gpetrou avatar gpetrou commented on June 20, 2024

@flobernd looks like the issue is in one of your generated files, so I cannot just change that. Can you please fix it? I assume that for raw json, we shouldn't use writer.WriteStartObject();, writer.WritePropertyName(value.VariantName);, etc...

from elasticsearch-net.

flobernd avatar flobernd commented on June 20, 2024

Hi @gpetrou,

the RawJsonQuery is a bit of a hack. The most easiest fix for me would be to separate the variant-name (e.g. "term") from the rest of the query payload:

var q = new RawJsonQuery("term", "{ \"fieldname\": \"value\"  }");

Would that work for you?


Special handling in the generator is possible, but I'd like to avoid that.

Btw.: In general you should prefer not using the RawJsonQuery, if the functionality is otherwise supported in the client. This construct was only added as a last-resort fallback when the client was still lacking a lot of features. Is there a specific reason for using RawJsonQuery in your case? I'm curious if I can "properly" improve things to simplify your use-case.

from elasticsearch-net.

gpetrou avatar gpetrou commented on June 20, 2024

There are still cases such as #8169 (comment) where this seems to be needed. I would expect this to work similarly to Nest.RawQuery.

from elasticsearch-net.

flobernd avatar flobernd commented on June 20, 2024

Yes, this case would work.

from elasticsearch-net.

tabareh avatar tabareh commented on June 20, 2024

Hi @gpetrou,

the RawJsonQuery is a bit of a hack. The most easiest fix for me would be to separate the variant-name (e.g. "term") from the rest of the query payload:

var q = new RawJsonQuery("term", "{ \"fieldname\": \"value\"  }");

Would that work for you?

Special handling in the generator is possible, but I'd like to avoid that.

Btw.: In general you should prefer not using the RawJsonQuery, if the functionality is otherwise supported in the client. This construct was only added as a last-resort fallback when the client was still lacking a lot of features. Is there a specific reason for using RawJsonQuery in your case? I'm curious if I can "properly" improve things to simplify your use-case.

There is well no RawJsonQuery constructor that accepts two params at least for version 8.13.12 that I use

from elasticsearch-net.

flobernd avatar flobernd commented on June 20, 2024

@tabareh Yes, this will be available after I released a fix.

from elasticsearch-net.

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.